Stair-climbing puzzle: Difference between revisions

Realize in F#
(Realize in F#)
(2 intermediate revisions by 2 users not shown)
Line 607:
end procedure</syntaxhighlight>
 
=={{header|F_Sharp|F#}}==
<syntaxhighlight lang="standard mlfsharp">
let rec step_up() = while not(step()) do step_up()
</syntaxhighlight>
=={{header|Factor}}==
<syntaxhighlight lang="factor">: step-up ( -- ) step [ step-up step-up ] unless ;</syntaxhighlight>
Line 1,479 ⟶ 1,483:
 
=={{header|Standard ML}}==
 
<syntaxhighlight lang="standard ml">
<syntaxhighlight lang="sml">
(*
* val step : unit -> bool
Line 1,490 ⟶ 1,495:
*)
fun step_up() = step() orelse (step_up() andalso step_up())
</syntaxhighlight>
 
Alternate version:
<syntaxhighlight lang="sml">fun step() = true
 
fun step_up() = while step() = false do step_up()
</syntaxhighlight>
 
Line 1,564 ⟶ 1,575:
{{trans|Kotlin}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "random" for Random
import "./fmt" for Conv
 
var rand = Random.new(1268) // generates short repeatable sequence
2,172

edits