> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/perl6-rosettacode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/perl6-rosettacode/programming_tasks/l/l-system.md).

# L-system

L-system functionality as a Role that may be mixed in to a scalar.

```perl
# L-system functionality 
role Lindenmayer {
    has %.rules;
    method succ {
        self.comb.map( { %!rules{$^c} // $c } ).join but Lindenmayer(%!rules)
    }
}

# Testing
my $rabbits = 'I' but Lindenmayer({I => 'M', M => 'MI'});

.say for $rabbits++ xx 6;
```

#### Output:

```
I
M
MI
MIM
MIMMI
MIMMIMIM
```

Also see:

[Dragon\_curve#Raku](https://rosettacode.org/wiki/Dragon_curve#Raku)

[Hilbert\_curve#Raku](https://rosettacode.org/wiki/Hilbert_curve#Raku)

[Koch\_curve#Raku](https://rosettacode.org/wiki/Koch_curve#Raku)

[Peano\_curve#Raku](https://rosettacode.org/wiki/Peano_curve#Raku)

[Penrose\_tiling#Raku](https://rosettacode.org/wiki/Penrose_tiling#Raku)

[Sierpinski\_curve#Raku](https://rosettacode.org/wiki/Sierpinski_curve#Raku)

[Sierpinski\_arrowhead\_curve#Raku](https://rosettacode.org/wiki/Sierpinski_arrowhead_curve#Raku)

[Sierpinski\_square\_curve#Raku](https://rosettacode.org/wiki/Sierpinski_square_curve#Raku)

among others...
