home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!swrinde!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: Inserting an object in a list
- Date: 18 Nov 92 16:19:44
- Organization: California Institute of Technology
- Lines: 20
- Message-ID: <TIM.92Nov18161944@nijinsky.ipac.caltech.edu>
- NNTP-Posting-Host: nijinsky.ipac.caltech.edu
- In-reply-to: mheiskan@hut.fi's message of 18 Nov 92 19:45:42 GMT
-
- OK, I've looked, even in sysRPL, but I can find no easy way to do what
- *should* be an easy operation. How does on insert an object into a
- given place in a list? I.e. Insert object ob after the i`th element of
- {}:
-
- {} %i ob -> {}'
-
- \<< 3 ROLLD DUP2 GET 1 \->LIST 4 ROLL + REPL \>>
-
- will do it, but is slow. Exploding the list onto the stack and inserting
- the new element then reassembling the list is faster, but complicated. A
- sysRPL function I wrote to divide the list in two at the key place, add
- the element and join the two halves takes ~70 bytes and still can only do
- 20 or so simple cases per second.
-
- The prickling in my neck tells me this is way too much trouble.
-
- What have I missed?
-
- -- Tim
-