Lindenmayer.jl: Defining recursive patterns in Julia

Tiny rules, huge art: Julia devs go wild over Lindenmayer.jl

TLDR: A tiny Julia package, Lindenmayer.jl, turns simple rewrite rules into striking fractal drawings using a virtual “turtle.” Commenters split between awestruck creatives and theory purists calling it “just grammars,” with side debates on “Why Julia?”—all proving simple rules can teach, delight, and stir drama.

Julia’s new toy, Lindenmayer.jl, lets you write a couple of tiny rules and watch them blossom into hypnotic patterns—think ferns, triangles, and “whoa, that escalated quickly.” It plugs into Luxor, a drawing tool, and uses a friendly “turtle” (a virtual pen) to move forward, turn left or right, and sketch the design. In simple terms: you feed it a short recipe, it keeps rewriting it, and the doodles bloom into fractals. Small rules, big vibes.

But the comments? Pure fireworks. One camp is starry‑eyed: “This is a core mental model for generative art,” cheering how a handful of axioms grow into jaw‑dropping visuals. Another camp puts on their professor glasses: “It’s just a context‑free grammar,” basically saying the magic is old news from the 1960s. Cue the classic showdown—artists who love seeing the lines grow vs. purists who want everyone to say the quiet part (the theory) out loud.

Meanwhile, the side quests are hilarious: people joking “press F to go forward,” “turtles all the way down,” and puns about “context‑free grandma.” The inevitable “Why Julia and not Python?” mini‑brawl pops up, with Julia fans praising speed and clean drawings, while skeptics shrug “any turtle can do this.” Yet newbies are thrilled: this is an approachable gateway to recursion—fancy word for “repeating rules”—and the community’s memes make it feel like play. Tiny rules, giant drama, gorgeous spirals.

Key Points

  • Lindenmayer.jl is a Julia package for defining and drawing L-systems, using Luxor.jl for rendering.
  • An L-system is defined by replacement rules and an initial state (axiom), producing recursive patterns.
  • The article demonstrates a Sierpinski triangle L-system with rules for symbols F and G and shows rapid state growth across iterations.
  • drawLSystem() maps characters to Luxor turtle commands (e.g., F/G move forward, +/− turn, digits set line width, t shifts hue).
  • Users can configure drawing parameters (step size, turn angle, iterations, start position, output format) when evaluating the L-system.

Hottest takes

“massive visual complexity from a handful of axioms” — AxiomLab
“L-systems are context-free grammars by another name” — canjobear
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.