REPLACE.DOC, an HPCVBBS posting by Joe Horn All about the System RPL word 'REPLACE' akcs.levenson@hpcvbbs.cv.hp.com (William J. Levenson) writes: > There seems to be many RPL words defined in entries.a that are not > mentioned in rplman.doc. I am specifically interested in REPLACE. > Is this similar to the User RPL REPL and what arguments are returned > and what arguments are expected? REPLACE is a version of STO that does not use the var's name. INPUT: 2: New object to be stored. 1: Old *contents* of variable (NOT NEWOB'd!!!) Then REPLACE will stuff the new object into the memory location of the old object, and drop the old object from the stack, leaving just the new object (at its new address) on the stack. EXAMPLE: "OLD" 'ABC' STO --> this stores "OLD" into ABC "NEW" ABC --> 2:NEW, 1:OLD (inside ABC) #85D3h SYSEVAL --> 1:NEW (also inside ABC now) ABC --> see? Thus, instead of FOO 'BAR' STO, use FOO BAR REPLACE. IMPORTANT: Since REPLACE assumes that the object on level 1 is inside a variable, be sure that it really is. If a NEWOB is performed on it, or if it is otherwise located in temporary memory (or anywhere other than inside a named var), REPLACE will corrupt memory and almost certainly cause a Memory Clear. The danger is worth it, however. I just timed 153 'ABC' STO, and it took 23.5 milliseconds; % 858 ID ABC REPLACE took 2 milliseconds! (Times can vary widely). NOTE: All previously posted lists of SYSEVAL addresses that contained 085D3 had the stack order backwards. If you keep such a list (e.g. for Voyager's use), be sure to update it.