use v6; use lib 'lib'; use ABC; my @matches = $*IN.slurp.comb(m/ /, :match); my %dg_notes = { 'g' => 1, 'a' => 1, 'b' => 1, 'c' => 1, 'd' => 1, 'e' => 1, '^f' => 1 } for @matches { my %header = header_hash(.
); say %header ~ ":"; my @notes = gather for . -> $line { for $line -> $bar { for $bar { when . { take .[0]; take .[1]; } when . { take .; } } } } my %key_signature = key_signature(%header); my @trouble = @notes.map({apply_key_signature(%key_signature, .)}).grep({!%dg_notes{lc($_)}:exists}); say @trouble.perl; }