diff options
| author | Daniel Mita <mienaikage@gmail.com> | 2019-11-22 13:41:32 +0000 |
|---|---|---|
| committer | Daniel Mita <mienaikage@gmail.com> | 2019-11-22 13:44:16 +0000 |
| commit | c19bf149e5457a3b2d658b44ee0107bf58dc4984 (patch) | |
| tree | 75d272d51809f6e8c035d3f9f58dae8e61088935 /challenge-035/daniel-mita | |
| parent | 96c7b5de514604382234a5c23470fe0cd1591a12 (diff) | |
| download | perlweeklychallenge-club-c19bf149e5457a3b2d658b44ee0107bf58dc4984.tar.gz perlweeklychallenge-club-c19bf149e5457a3b2d658b44ee0107bf58dc4984.tar.bz2 perlweeklychallenge-club-c19bf149e5457a3b2d658b44ee0107bf58dc4984.zip | |
Ignore whitespace in decoder
Diffstat (limited to 'challenge-035/daniel-mita')
| -rw-r--r-- | challenge-035/daniel-mita/perl6/Morse.pm6 | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/challenge-035/daniel-mita/perl6/Morse.pm6 b/challenge-035/daniel-mita/perl6/Morse.pm6 index 106d7b8846..b387cd9904 100644 --- a/challenge-035/daniel-mita/perl6/Morse.pm6 +++ b/challenge-035/daniel-mita/perl6/Morse.pm6 @@ -88,10 +88,13 @@ module Morse { #| Decode binary morse code sub decode ( - Str $bits where *.trim.comb.all eq 1|0, #= A string containing a sequence of 1s and 0s + Str $bits where *.comb(/\S/).all eq 1|0, #= A string containing a sequence of 1s and 0s --> Str ) is export { - .return with Decode.parse( $bits.trim, :actions(Decoder.new) ).made; + .return with Decode.parse( + $bits.trans( /\s+/ => '' ), + :actions(Decoder.new) + ).made; X::Morse::InvalidSequence.new.throw; } |
