tinylocals.txt


\ tinylocals 98.11.11 11:44 pm NAB
\ Non-standard locals, L0 to L7.
\ 'use-locals' nests previous values.

needs core-ext

0 value L0  0 value L1  0 value L2
0 value L3  0 value L4  0 value L5
0 value L6  0 value L7

: unnest
  r> to L7  r> to L6  r> to L5  r> to L4
  r> to L3  r> to L2  r> to L1  r> to L0
;

: &unnest.  ['] unnest xt>abs ;

: use-locals
  L0 >r  L1 >r  L2 >r  L3 >r
  L4 >r  L5 >r  L6 >r  L7 >r
  &unnest.  2>r ; inline

needs tools-ext
0 [if]
: test ( 0 -- 0 1 2 3 4 5 4 3 2 1 0 )
  use-locals
  to L4  L4 dup
  1+ dup 5 < if  recurse  then
  L4 ;

needs tester
TESTING tinylocals
{ 0 test -> 0 1 2 3 4 5 4 3 2 1 0 }
[then]


  HTMLized by Forth2HTML