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.
02:55 theesm left 04:17 theesm joined 06:01 initrd joined 06:48 Heptite left 06:49 teatwo joined 06:53 tea3po left 09:19 initrd left
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
11:27 Heptite joined 13:52 ab5tract joined, ab5tract left 14:34 jacob_c left 14:58 jacob_c joined
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
15:13 jacob_c left 15:39 initrd joined 18:26 jacob_c joined 18:33 jacob_c left 18:50 teatwo left, teatwo joined 19:23 tea3po joined 19:26 teatwo left 19:46 guifa_ joined 19:49 guifa left 21:39 rf joined 22:06 jgaz joined 22:47 initrd left 22:57 jgaz left