I found little information about drawing using the L-system in Elm. There is an L-system library but it is not up do date really, all I have found that could be useful is a turtle graphics library (https://github.com/mrdimosthenis/turtle-graphics) but I am unsure how to draw with it using the L-system. What I have got so far is just a way to generate the nth generation of a sentence from an axiom and a rule:
rule1 : LSystem.Rule State
rule1 state =
case state of
A ->
[ A, B ]
B ->
[ A ]
generateNTimes : Int -> (Rule State) -> List State -> List State
generateNTimes n rule axiom =
let aux state acc =
if n <= 0
then state
else generateNTimes (n - 1) rule ((apply rule state) ++ acc)
in
aux axiom []
I tried drawing using the turtle graphics library I mentioned above, but I am unable to see how I could use it together with the L-system.