Sudan function: Difference between revisions
Content added Content deleted
(Added Phix,moved PHP into order) |
(add ruby implementation) |
||
Line 446: | Line 446: | ||
[1] "F(1,3,3) = 35" |
[1] "F(1,3,3) = 35" |
||
</pre> |
</pre> |
||
=={{header|Ruby}}== |
|||
<lang ruby> |
|||
def sudan(n, x, y) |
|||
return x + y if n == 0 |
|||
return x if y == 0 |
|||
sudan(n - 1, sudan(n, x, y - 1), sudan(n, x, y - 1) + y) |
|||
end |
|||
</lang> |
|||
Output |
|||
<pre> |
|||
puts sudan(1, 3, 3) |
|||
> 35 |
|||
</pre> |
|||
=={{header|Vlang}}== |
=={{header|Vlang}}== |