I felt the need to have an additional stack to store intermediate results during computation, that can store data of any type (float, complex numbers, strings, matrices an even lists). Luckily Thomas Okken introduced lists as a new data type in Free42 3.0.9.
The number of elements on the stack is only limited by the available0 memory.
The program works both in NSTK and 4STK mode.
I replaced my original source code of PUSH with Thomas Okkens version because it is better than my first version. The POP routine has been changed not to return NO but the error NONEXISTENT if the stack is empty.
01▸LBL "Push" 02 FUNC 10 03 NEWLIST 04 X<>Y 05 APPEND 06 SF 25 07 RCL "μ" 08 FS?C 25 09 EXTEND 10 STO "μ" 11 RTN 12▸LBL "PushAll" 13 LNSTK 14 DEPTH 15 LSTO "c" 16 DROP 17▸LBL 02 18 XEQ "Push" 19 DSE "c" 20 GTO 02 21 RTN 22▸LBL "Pop" 23 FUNC 01 24 SF 25 25 HEAD "μ" 26 RTN 27 RTNERR 6 28▸LBL "PopAll" 29 SF 25 30▸LBL 00 31 XEQ "Pop" 32 FS? 25 33 GTO 00 34 CF 25 35 END
Click here to download the PUSHPOP.raw file.