home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / hp48 / 5822 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.2 KB

  1. 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
  2. From: tim@nijinsky.ipac.caltech.edu (Tim Conrow)
  3. Newsgroups: comp.sys.hp48
  4. Subject: Inserting an object in a list
  5. Date: 18 Nov 92 16:19:44
  6. Organization: California Institute of Technology
  7. Lines: 20
  8. Message-ID: <TIM.92Nov18161944@nijinsky.ipac.caltech.edu>
  9. NNTP-Posting-Host: nijinsky.ipac.caltech.edu
  10. In-reply-to: mheiskan@hut.fi's message of 18 Nov 92 19:45:42 GMT
  11.  
  12. OK, I've looked, even in sysRPL, but I can find no easy way to do what
  13. *should* be an easy operation. How does on insert an object into a
  14. given place in a list? I.e. Insert object ob after the i`th element of
  15. {}:
  16.  
  17. {} %i ob -> {}'
  18.  
  19. \<< 3 ROLLD DUP2 GET 1 \->LIST 4 ROLL + REPL \>> 
  20.  
  21. will do it, but is slow. Exploding the list onto the stack and inserting
  22. the new element then reassembling the list is faster, but complicated. A
  23. sysRPL function I wrote to divide the list in two at the key place, add
  24. the element and join the two halves takes ~70 bytes and still can only do
  25. 20 or so simple cases per second.
  26.  
  27. The prickling in my neck tells me this is way too much trouble. 
  28.  
  29. What have I missed?
  30.  
  31. -- Tim
  32.