Stair-climbing puzzle: Difference between revisions

Logo
(Forth)
(Logo)
Line 311:
for (int i = 0; i < 1; step() ? ++i : --i);
}</lang>
 
=={{header|Logo}}==
Recursive.
to step.up
if not step [step.up step.up]
end
Constant space (fully tail-recursive).
to step.up [:n 1]
if :n=0 [stop]
(step.up ifelse step [:n-1] [:n+1])
end
 
=={{header|OCaml}}==
Anonymous user