home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!nntp-server.caltech.edu!nntp-server.caltech.edu!tim
- From: tim@nijinsky.ipac.caltech.edu (Tim Conrow)
- Newsgroups: comp.sys.hp48
- Subject: Re: Inserting an object in a list
- Date: 23 Nov 92 14:31:01
- Organization: California Institute of Technology
- Lines: 30
- Message-ID: <TIM.92Nov23143101@nijinsky.ipac.caltech.edu>
- References: <TIM.92Nov18161944@nijinsky.ipac.caltech.edu> <MHEISKAN.92Nov201113
- <2b0f36c6.2217.2comp.sys.hp48.1@hpcvbbs.cv.hp.com>
- NNTP-Posting-Host: nijinsky.ipac.caltech.edu
- In-reply-to: akcs.joehorn@hpcvbbs.cv.hp.com's message of Sun, 22 Nov 1992 07:40:02 GMT
-
- Mika Heiskanen and Joe Horn have both conbtributed code and comments
- (either in email or on the net) to this discussion and after thinking
- them over and playing around some more, the following is what I came
- up with. Comments welcome. I've included extra code for making it
- reasonably safe. I call it LINS (ListINSert).
-
- Disclaimer: I can't break it, but you might be able to. If you do,
- don't blame me.
-
- %%HP: T(3)A(D)F(.);
- @ LINS; {} %i obj --> {}'
- @ Insert obj into list {} AFTER element %i.
- @ %i<= 0 inserts at head of the list,
- @ %i > SIZE of {} appends to the end of the list.
- @ "{1 2 3 5 6 7} 3 4 LINS" requires ~ .016 sec.s as best as I can measure it.
- @ 52.5 Bytes, Checksum = #411h
- "::
- CK3&Dispatch
- # 510
- ::
- ROT INNERDUP #2+ROLL OVER #3+ ROLL COERCE 3PICKSWAP OVER #MIN
- #- #2+UNROLL #1+ {}N
- ;
- ;"
-
- Thanks for the help, y'all!
-
- -- Tim
-
- PS. I used Detlef Mueller's RPL library. Thanks Detlef!
-