3 ms·
https://github.com/bmitc/fsharp-science-and-math-notebooks/blob/main/the-algorithmic-beauty-of-plants.ipynb https://github.com/bmitc/fsharp-science-and-math-not
by bmitc 3y ago
https://github.com/bmitc/fsharp-science-and-math-notebooks/blob/main/the-algorithmic-beauty-of-plants.ipynb https://github.com/bmitc/fsharp-science-and-math-notebooks/b...
I have had the book for years but recently started properly going through it with F# inside a Polyglot Notebook. I have all the 2D diagrams drawn up until the book starts with the stochastic drawings, which I'll tackle next. F# makes it so nice to build an embedded DSL for the L-systems and then the turtle interpretation of them.
// Figure 1.9 (d)
let kochD =
{ Alphabet = ['F'; 'f'; '+'; '-']
Axiom = "F-F-F-F"
Productions =
[ 'F' => "FF-F--F-F" ] }
drawTurtleSystem 4 defaultTurtle kochD
I'm not sure what I'm going to do with the 3D drawings. There may be a way in the Polyglot Notebook to have F# emit WebGL or something.