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.
snonux hey there, is there a way to print all possibilities of an given enum? E.g., i would like to get Tick Trick and Track out of Foo. raku -e 'enum Foo <Tick Trick Track>; Foo.say'; 10:10
(Foo)
Nemokosch m: enum Foo <Tick Trick Track>; say Foo.keys; 10:11
Raku eval (Track Tick Trick)
snonux ❯ raku -e 'enum Foo <Tick Trick Track>; Foo.^enum_value_list.say'; 10:12
(Tick Trick Track)
ah, keys is better, thanks a lot!
Nemokosch It's kind of a Map 10:13
snonux like a Ruby Set, which is a map but only with keys 10:14
Nemokosch Or a Raku Set 😉
snonux :D 10:15
One day, i have to blog about my favourite Ruby features and how they work in Raku. Could also encourage more Ruby developers to try out Raku. 10:16
Nemokosch I heard Ruby also stated off as a "fixed Perl" 10:20
snonux There's some truth to it. I started off with Perl, then (due to my job), switched to Ruby (while still using Perl for some personal projects), and now, I start to fall in love with Raku. 10:23
snonux OK, one difference between MyEnum.^enum_value_list and just MyEnum.keys is, that .keys returns a sequence of Str, whereas ^enum_value_list really returns a Seq of enums. 15:01
raku -e 'enum Foo <Tick Trick Track>; subset Bar of Foo where * ne any (Track); say Foo.^enum_value_list.first.WHAT, Foo.keys.first.WHAT' 15:02
(Foo)(Str)
Nemokosch one looks like standard Raku, the other is in metamodel territory 15:09