RosettaCodeData/Task/Man-or-boy-test/Crystal/man-or-boy-test.cr
2024-10-16 18:07:41 -07:00

7 lines
205 B
Crystal

def a(k, x1, x2, x3, x4, x5)
b = uninitialized -> typeof(k)
b = ->() { k -= 1; a(k, b, x1, x2, x3, x4) }
k <= 0 ? x4.call + x5.call : b.call
end
puts a(10, -> {1}, -> {-1}, -> {-1}, -> {1}, -> {0})