Paradiddles applied to “Paradiddles”:
PaPPaPaaaraararrrarraraaadaadadddiddidiiidiididddddddddddlddldlllelleleeeseesess
aPaaPaPPrarraraaaraararrdaddadaaidiididddiddidiiddddddddldlldlddeleelellsessesee
Sign up for the a100ql newsletter where I share news, thoughts, essays and materials related to the blog once or twice per month.
Great exercise!
#!/usr/bin/env perl
use strict;
use warnings;
my $str = “Paradiddles”;
my @str = split //, $str;
my @pattern = (0,1,0,0,1,0,1,1);
my $rlrr;
my $lrll;
for (my $i = 0; $i < @str-1 ; ++$i) {
for (my $j = 0; $j < @pattern ; ++$j) {
$rlrr .= $str[$i + $pattern[$j]];
$lrll .= $str[$i + $pattern[($j + @pattern/2) % @pattern]];
}
}
print $rlrr, $/;
print $lrll, $/;
I just came across this again now – thank you so much, Bernhard!