This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
a12l Thanks @nahita3882! Have I understood it correct that the only difference between rx { ... } and m { ... } is that you can't manually apply the ~~ operator on the later because it already automatically does $_ ~~ on it? 08:55
10:50 teatime left 10:53 teatime joined
This is my solution to the Bob exercise on Exercism [0]. It currently passes all tests. Do you have any suggestions for improvement? The first thing I would do is to move the regexes out to some form of routine, enabling me to call it when checking the conditions. [0] exercism.org/tracks/raku/exercises/bob raku unit role Bob; method hey () { given self.trim { when .ends-with: "?" { 12:29
when m:global{<alpha>} && m:global{ <alpha>+ } eq m:global{ <upper>+ } { "Calm down, I know what I'm doing!" } default { "Sure." } } when m:global{<alpha>} && m:global{ <alpha>+ } eq m:global{ <upper>+ } { "Whoa, chill out!" } when "" { "Fine. Be that way!" } default { "Whatever." } } }
wambash You could use docs.raku.org/language/typesystem#subset > my subset Question where *.ends-with: '?'; and then > when Question { 13:42
13:49 jaguart joined 13:50 jaguart left 13:51 jaguart joined
a12l Thanks for the tip! raku unit role Bob; method hey () { my subset Shouting of Str where m:global{<alpha>} && m:global{ <alpha>+ } eq m:global{ <upper>+ }; given trim self { when .ends-with: "?" { when Shouting { "Calm down, I know what I'm doing!" } default { "Sure." } } when Shouting { "Whoa, chill out!" } when "" { "Fine. Be that way!" } 14:17
default { "Whatever." } } }
14:44 swaggboi left 14:45 swaggboi joined 14:46 jaguart left 15:09 jaguart joined 16:29 jaguart left 16:38 jaguart joined 17:11 jaguart left 17:13 jaguart joined 17:37 jaguart left 20:05 MasterDuke left 20:27 sjn left, sjn joined