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:16 razetime joined 01:30 MasterDuke joined 02:04 gfldex left 02:06 gfldex joined
thowe in Raku regex, how do you match NOT a character. Like, NOT 'a'? Wouldn't it be something like !a? 02:34
I'm trying to match "a string of any characters that doesn't include a tab". 02:35
I came up with <-[\t]>+ is that right? seems to work. 02:40
02:44 teatwo left 02:46 teatime joined 02:58 teatime left, teatime joined 03:33 poohman joined 03:35 poohman left, poohman joined 04:24 razetime left 04:45 razetime joined 04:59 razetime left 05:44 poohman left 05:45 siavash joined 07:22 siavash is now known as CIAvash 07:59 habere-et-disper joined
habere-et-disper Hello Rackoons ! o/\o 08:00
What's are some other ways of saying `[==] @array` ?
I feel like I want to say `@array.all ...` but get stuck. 08:01
08:02 dakkar joined
nemokosch Probably not 08:02
habere-et-disper Okay -- thanks. 08:06
nemokosch There could be something like, "is the number of unique values 1" but i don't think that's better than the reduction 08:08
habere-et-disper Thanks -- I forget about `unique`, like I do `first`.
nemokosch With all, what about @array.head == @array.skip.all 08:09
habere-et-disper Clever, but you're right that the intent is getting lost. 08:10
One other one... here I'm looking for patterns of 2 of a kind together with 3 of a kind in a dice roll: `[5,5,4,5,4].Bag.values.sort ~~ (2,3)`. Does that look iffy ? 08:11
08:13 teatwo joined
nemokosch It would be nice imo to get away without the sort 08:14
habere-et-disper That's what I was aiming for too. 08:15
08:15 teatwo left, teatwo joined 08:16 teatime left
nemokosch m: [5,5,4,5,4].Bag.values ~~ Set(2,3) andthen .say 08:18
Raku eval True
nemokosch worth a try
Yeah, this seems okay. But then at this point actually we might as well just use (==) 08:21
m: [5,5,4,5,4].Bag.values (==) (2,3) andthen .say
Raku eval True
habere-et-disper m: [5,5,4,5,4].Bag.values.contains( 2 & 3) 08:39
camelia ( no output )
habere-et-disper m: [5,5,4,5,4].Bag.values.contains( 2 & 3).say
camelia all(True, True)
nemokosch uh oh, I think contains is the wrong one 08:40
yes, this works on a string
m: (1 xx 12).Bag.values.contains( 2).say 08:41
Raku eval True
nemokosch but anyway, this would only be the (<=) direction of the check 08:43
habere-et-disper Right. So why not grep : 08:44
m: [1,1,2,1,2].Bag.values.grep( 2 & 3 ).so.say
camelia False
nemokosch contains (besides being a string search) acts on individual values 08:46
grep, however, is a matcher kind of function; it doesn't distribute over the junction
now good luck finding a value that matches to 2 & 3 😄 08:47
m: [1,1,2,1,2].Bag.values.grep( 2 | 3 ).so.say
Raku eval True
nemokosch "is there at least one value that is either 2 or 3"
not too useful or readable
habere-et-disper I understand now. Thank you for explaining. (y) 08:49
08:49 ab5tract joined
nemokosch 🍬 08:50
09:59 ab5tract left 10:27 habere-et-disper left 12:20 CIAvash left 12:22 jgaz left, jgaz_ joined 12:36 ab5tract joined 12:57 ab5tract left 13:22 poohman joined 13:29 ab5tract joined 15:12 ab5tract left 16:18 razetime joined 16:35 dakkar left 17:30 poohman left 17:52 razetime left 19:17 habere-et-disper joined 19:19 habere-et-disper left 20:14 tea3po joined 20:18 teatwo left 20:24 tea3po left 20:25 tea3po joined