L-system: Difference between revisions

Realize in F#
No edit summary
(Realize in F#)
Line 87:
:* Wikipedia: [[wp:L-system|L-system]]
 
=={{header|F_Sharp|F#}}==
<syntaxhighlight lang="fsharp">
// L-system. Nigel Galloway: April 1th., 2024
type rabbit= M|I
let rules=function I->[M] |M->[M;I]
let L axiom rules=Seq.unfold(fun n->Some(n,n|>Seq.map(rules)|>Seq.concat)) axiom
L [I] rules|>Seq.take 6|>Seq.iter(fun n->n|>Seq.iter(printf "%A");printfn "")
</syntaxhighlight>
{{out}}
<pre>
I
M
MI
MIM
MIMMI
MIMMIMIM
</pre>
=={{header|Fōrmulæ}}==
 
2,172

edits