Dear Log,
PostScript doodlings. Look, I'm "trusting the stack"!!!!!
/reversed { % array => reversed-of-array dup length 0 eq { pop [] % and that's it } { % else normal case of it being nonempty: % This is awful /because/ we do it all on the stack dup length array 0 1 3 index length 1 sub { % Get everything in order for the "get put" pair at the end exch dup 3 2 roll dup 4 index length exch sub 1 sub exch 4 index exch get put } for exch pop } ifelse } def /proc { % name [varnames] routine proc, - exch reversed { _ dict begin _ {exch def} forall _ exec end } % /target Oldblock [/c/b/a] Newblock 3 1 roll % /target Newblock Oldblock [/c/b/a] dup length 1 add 3 mul 3 index exch 0 exch put 2 index exch 3 exch put 1 index exch 6 exch put % name Newblock def } defAll this so I can now declare procedures like this;
/subname [/x /y /z] { ... } procand have it expand to:
/subname { SomeReasonableNumber dict begin % begin scope /z exch def /y exch def /x exch def ... end } def
Re:Forth based languages
TorgoX on 2004-09-10T08:21:00
I'll change that!