Quick actions

cmd+k|ctrl+k

Navigation

Languages

279 #2

Snippet info

Language

Raku

Visibility

public

Author

fernando-correa

Created

2024-07-28T10:28:14.095596Z

Updated

2024-07-28T10:32:09.316543Z

use Test;

my Str() @vowels = <a e i o u>;
multi split-string(Str() @string) {
    so @string>>.lc.grep(@vowels.one) %% 2
}
multi split-string(Str() $string) {
    $string.lc.comb(/@vowels/) %% 2
}

for [
    "perl", False,
    "book", True,
    "good morning", True,
] -> $string, $is {
    is $string.&split-string, $is, "$string -> $is";
    is $string.comb.&split-string, $is, "$string.comb() -> $is";
}
INFO