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. |
|||
01:23
MasterDuke joined
05:45
MasterDuke left
|
|||
a12l | Someone here that have done the Exercism exercises for Raku? I'm looking at the Bob exercise there I should define the role Bob, but I don't understand how the tests want me to write the hey method. | 12:21 | |
And no explanation in the instructions | 12:22 | ||
antononcube | Link(s)> | 12:59 | |
wambash | The following satisfies some tests > unit role Bob; > multi method hey (Str $ : ) { 'Sure.' };` | 14:05 | |
a12l | Thanks! Didn't realise that I should use multiple dispatch on that method. | 15:11 | |
rcmlz | exercism.org/tracks/raku/exercises/bob | 17:41 | |
github.com/exercism/raku/tree/main...actice/bob | 17:43 | ||
a12l | Hmm, that doesn't seem to work for me. I still have 25 failing tests after adding it raku unit role Bob; multi method hey () { return self; } multi method hey (Str $ : ) { 'Sure.' }; | 18:41 | |
This is my initial huggly solution to the exercise, and I still have 25 failing tests raku unit role Bob; multi method hey () { return self; } multi method hey (Str $say) { if $say eq $say.uc && $say.index($say.chars - 1) eq "?" { } elsif $say eq $say.uc { return "Whoa, chill out!"; } elsif $say eq "" { return "Fine. Be that way!"; } else { return "Whatever."; } | 18:43 | ||
} #`[ multi method hey (Str $ : ) { 'Sure.' }; ] | |||
Thank you! Didn't know they had solutions hidden in the git repo. I guess that you only see it if you are reviewing someones submission? github.com/exercism/raku/blob/main...ob.rakumod | 18:45 | ||
That solution seems to be a bit advances for an third exercise in the language | 18:46 | ||
wambash | > $say.index($say.chars - 1) index vs substr docs.raku.org/routine/substr | 21:02 | |
ab5tract | That does seem a bit advanced for a third question | 22:20 | |
Feels like you should be introduced to regex character classes and given/when beforehand | 22:21 | ||
Or subsets/where clauses and multis so that you can move the given/when logic out into multi method dispatch | 22:22 |