L-system: Difference between revisions

Content deleted Content added
PureFox (talk | contribs)
→‎{{header|Wren}}: Added the rabbit population example.
Added Algol 68
Line 86:
 
:* Wikipedia: [[wp:L-system|L-system]]
 
=={{header|ALGOL 68}}==
{{libheader|ALGOL 68-l-system}}
Note, the Algol 68 L-System library source code is on a separate page on Rosetta Code - follow the above link and then to the Talk page.
<syntaxhighlight lang="algol68">
BEGIN # Example of L-System evaluation and interpretation #
 
PR read "lsystem.incl.a68" PR # include L-System utilities #
 
# task rabbit population example #
LSYSTEM rabbit population = ( "I", ( "I" -> "M"
, "M" -> "MI"
)
);
INT young := 0, old := 0;
STRING result = rabbit population EVAL 5;
result INTERPRET ( ( CHAR c )VOID: IF c = "I" THEN young +:= 1 ELSE old +:= 1 FI );
 
print( ( "After 5 iterations there are ", whole( old, 0 ), " old rabbits and "
, whole( young, 0 ), " young ones (", result, ")", newline
)
)
 
END
</syntaxhighlight>
{{out}}
<pre>
After 5 iterations there are 5 old rabbits and 3 young ones (MIMMIMIM)
</pre>
 
=={{header|F_Sharp|F#}}==
Line 104 ⟶ 133:
MIMMIMIM
</pre>
 
=={{header|Fōrmulæ}}==