RosettaCodeData/Task/Sudan-function/Quackery/sudan-function.quackery

21 lines
370 B
Plaintext

[ rot dup 0 = iff
[ drop + ] done
over 0 = iff
2drop done
over temp put
dup 1 -
swap 2swap 1 -
recurse
dup temp take +
again ] is sudan ( n x y --> f(n) )
' [ [ 0 0 0 ]
[ 1 1 1 ]
[ 1 3 3 ]
[ 2 1 1 ]
[ 2 2 1 ]
[ 3 1 1 ] ]
witheach
[ dup echo say " = "
do sudan echo cr ]