Util <@!297037173541175296> We more reasonably check for membership in a hash by just looking the key up in the hash. 05:13
In your code, this neatly dovetails with the need in the next line to use the looked-up value.
Also dovetailing, an `if` statement can alias the result of its condition, and you want a "normal" list, so how about:
constant $basis-postfix = 'Foo'; # Added to make example compile
my $choice = 3; # Added to make example compile
constant \choices = {
1 => ('old', "old_$basis-postfix"),
2 => ('new', 'old'),
3 => ('new', 'old', "old_$basis-postfix"),
};
if choices{$choice} -> @meld_params {
run 'meld', |@meld_params;
``` 05:15
constant $basis-postfix = 'Foo'; # Added to make example compile
my $choice = 3; # Added to make example compile
constant \choices = {
1 => ('old', "old_$basis-postfix"),
2 => ('new', 'old'),
3 => ('new', 'old', "old_$basis-postfix"),
};
if choices{$choice} -> @meld_params {
run 'meld', |@meld_params;
}
else {
say "Choice $choice was not valid. Please choose from {choices.keys.sort.join(',')}";
}
05:17 Util joined
Nemokosch You know, I'm not sure how much that check was meant for the hash. It was more for the type of the choice (and there is only this one type so far) 06:46
08:08 dakkar joined 09:39 discord-raku-bot left 09:40 discord-raku-bot joined 16:39 dakkar left 16:50 zacts joined
zacts hi 16:50
what resources are there for a complete beginner to learn raku?
16:51 lizmat_ joined 16:55 lizmat left 16:56 lizmat_ left, lizmat joined
gfldex zacts: raku.org/resources/ got a section called For Newcomers 16:58
please note the distinction between between Newcomers and Beginners. I'm a Raku Beginner since 2008 myself. 16:59
zacts thanks gfldex 17:31
22:39 TempIRCLogger joined