4 ms·
I made a toy implementation of this sort of thing in Forth: http://pastebin.com/vHaU3jPW http://pastebin.com/vHaU3jPW This code isn't very well factored, but
by RodgerTheGreat 15y ago
I made a toy implementation of this sort of thing in Forth:
http://pastebin.com/vHaU3jPW http://pastebin.com/vHaU3jPW
This code isn't very well factored, but I think the results are pretty clean looking. With this code:
: printPair ." ( " . ." , " . ." )" space ;
1 2 counter 0 5 range zip 1 2 counter 3 7 range zip chain ' printPair map
You get this output:
( 0 , 1 ) ( 1 , 3 ) ( 2 , 5 ) ( 3 , 7 ) ( 4 , 9 ) ( 5 , 11 )
( 3 , 1 ) ( 4 , 3 ) ( 5 , 5 ) ( 6 , 7 ) ( 7 , 9 )