Anonymous recursion: Difference between revisions

Content added Content deleted
(Add Aldor task)
(Add Déjà Vu)
Line 385: Line 385:
}</lang>
}</lang>
The output is the same.
The output is the same.
=={{header|Déjà Vu}}==
===With Y combinator===
<lang dejavu>Y f:
labda y:
labda:
f y @y
call dup

labda fib n:
if <= n 1:
1
else:
fib - n 1
fib - n 2
+
Y
set :fibo

for j range 0 10:
print fibo j</lang>
===With <code>recurse</code>===
<lang dejavu>fibo-2 n:
n 0 1
labda times back-2 back-1:
if = times 0:
back-2
elseif = times 1:
back-1
elseif = times 2:
+ back-1 back-2
else:
recurse -- times back-1 + back-1 back-2
call

for j range 0 10:
print fibo-2 j</lang>

Note that this method starts from 0, while the previous starts from 1.


=={{header|Dylan}}==
=={{header|Dylan}}==