Anonymous recursion: Difference between revisions
Content added Content deleted
(→{{header|C}}: another example using GNU C extensions) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 286: | Line 286: | ||
<pre>missing value, missing value, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 |
<pre>missing value, missing value, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 |
||
55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765</pre> |
55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765</pre> |
||
=={{header|Arturo}}== |
|||
{{trans|Nim}} |
|||
<lang rebol>fib: function [x][ |
|||
; Using scoped function fibI inside fib |
|||
fibI: function [n][ |
|||
(n<2)? -> n -> add fibI n-2 fibI n-1 |
|||
] |
|||
if x < 0 -> panic "Invalid argument" |
|||
return fibI x |
|||
] |
|||
loop 0..4 'x [ |
|||
print fib x |
|||
]</lang> |
|||
{{out}} |
|||
<pre>0 |
|||
1 |
|||
1 |
|||
2 |
|||
3</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |