Joy (programming language): Difference between revisions

Content deleted Content added
External links: Tweak cite
Line 53:
So the square function makes a copy of the top element, and then multiplies the two top elements of the stack, leaving the square of the original top element at the top of the stack, with no need for a formal parameter. This makes Joy concise, as illustrated by this definition of [[quicksort]]:
 
<pre><nowiki>
DEFINE qsort ==
<nowiki>
[small]
DEFINE qsort ==
[small]
[uncons [>] split]
[enconcat]
[uncons [>] split]
binrec.
[enconcat]
</nowiki></pre>
binrec.
</nowiki>
</pre>
 
"binrec" is one of Joy's many [[recursion|recursive]] [[combinator]]s, implementing binary recursion. It expects four quoted programs on top of the stack which represent: