Anonymous recursion: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added whitespace, used a template for the output sections.) |
Not a robot (talk | contribs) (Add APL) |
||
Line 75: | Line 75: | ||
FI; |
FI; |
||
</lang> |
</lang> |
||
=={{header|APL}}== |
|||
APL has the symbol <code>∇</code> which calls the current function recursively. |
|||
Functions can be defined and then called in place without ever assigning them a name, |
|||
though they are not quite first-class objects (you can't have an array of functions for example). |
|||
<lang APL>fib←{ ⍝ Outer function |
|||
⍵<0:⎕SIGNAL 11 ⍝ DOMAIN ERROR if argument < 0 |
|||
{ ⍝ Inner (anonymous) function |
|||
⍵<2:⍵ |
|||
(∇⍵-1)+∇⍵-2 ⍝ ∇ = anonymous recursive call |
|||
}⍵ ⍝ Call function in place |
|||
}</lang> |
|||
=={{header|AppleScript}}== |
=={{header|AppleScript}}== |