32 lines
737 B
Plaintext
32 lines
737 B
Plaintext
[ [] unrot
|
|
swap nested
|
|
' join nested
|
|
join nested
|
|
' witheach nested
|
|
swap join
|
|
do ] is fs ( f s --> [ )
|
|
|
|
[ 2 * ] is f1 ( n --> n )
|
|
|
|
[ 2 ** ] is f2 ( n --> n )
|
|
|
|
[ ' f1 swap fs ] is fsf1 ( s --> [ )
|
|
|
|
[ ' f2 swap fs ] is fsf2 ( s --> [ )
|
|
|
|
' [ 0 1 2 3 ] fsf1 echo cr
|
|
' [ 0 1 2 3 ] fsf2 echo cr
|
|
' [ 2 4 6 8 ] fsf1 echo cr
|
|
' [ 2 4 6 8 ] fsf2 echo cr
|
|
|
|
( ... or, using Quackery's partial applicator "witheach",
|
|
which applies the word or nest following it to each
|
|
item in a nest on the top of the stack ... )
|
|
|
|
cr
|
|
|
|
' [ [ 0 1 2 3 ] [ 2 4 6 8 ] ]
|
|
witheach
|
|
[ dup ' [ fsf1 fsf2 ]
|
|
witheach [ do echo cr ] ]
|