Repeat: Difference between revisions

367 bytes added ,  11 months ago
(Added various dialects BASIC (BASIC256, QBasic, Chipmunk Basic, GW-BASIC, True BASIC, Minimal BASIC, MSX Basic, Quite BASIC and XBasic))
Line 1,256:
=={{header|Lean}}==
 
It runs on ===Lean 3.4.2:===
<syntaxhighlight lang="lean">
 
<syntaxhighlight lang="lean">def repeat : ℕ → (ℕ → string) → string
| 0 f := "done"
| (n + 1) f := (f n) ++ (repeat n f)
Line 1,265:
#eval repeat 5 $ λ b : ℕ , "me "
</syntaxhighlight>
 
{{out}}
<pre>
"me me me me me done"
</pre>
 
===Lean 4===
<syntaxhighlight lang="lean">
def repeatf (f : Nat -> String) (n : Nat) : String :=
match n with
| 0 => "."
| (k + 1) => (f k) ++ (repeatf f k)
 
def example1 : String :=
repeatf (fun (x : Nat) => toString (x) ++ " ") (10)
 
#eval example1
</syntaxhighlight>
 
{{out}}
<pre>
"9 8 7 6 5 4 3 2 1 0 ."
</pre>
 
=={{header|LiveCode}}==
92

edits