Ackermann function: Difference between revisions

m
m (syntax highlighting fixup automation)
Line 4,943:
 
=={{header|Joy}}==
<syntaxhighlight lang=joy>DEFINE ack == [ [ [pop null] popd succ ]
From [http://www.latrobe.edu.au/phimvt/joy/jp-nestrec.html here]
[[null] pop pred 1 ack]
<syntaxhighlight lang=joy>DEFINE ack == [ [ [pop null] popd succ ]
[[dup pred [ [nullswap] popdip pred 1ack ack ]]
cond.</syntaxhighlight>
[ [dup pred swap] dip pred ack ack ] ]
another using a combinator:
cond.</syntaxhighlight>
<syntaxhighlight lang=joy>DEFINE ack == [ [ [pop null] [popd succ] ]
another using a combinator
[[null] [pop pred 1] []]
<syntaxhighlight lang=joy>DEFINE ack == [ [ [pop null] [popd succ] ]
[ [null] [popdup pred 1swap] dip pred] [] []]]
condnestrec.</syntaxhighlight>
[ [[dup pred swap] dip pred] [] [] ] ]
condnestrec.</syntaxhighlight>
Whenever there are two definitions with the same name, the last one is the one that is used, when invoked.
 
=={{header|jq}}==
153

edits