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.
00:44 thundergnat left 03:02 frost joined 03:14 frost left 04:21 uzl[m] left, SmokeMachine left, aqua1 left, codesections left 04:22 aqua1 joined, SmokeMachine joined, codesections joined 04:27 mjgardner left, mjgardner joined 04:31 uzl[m] joined 07:52 dakkar joined 08:20 frost joined 08:24 frost left 08:27 frost joined
Nemokosch m: my @demo = 'a', ('b' xx *).Slip; dd @demo.head(20); 09:46
is there an even nicer way to make an infinite repetition with some custom "prefix"? 09:48
m: my @demo = lazy flat 'a', 'b' xx *; dd @demo.head(20);
this is getting insane 😂
the feeling of endless possibilities 09:50
09:52 discord-raku-bot left, discord-raku-bot joined 10:35 frost left 11:52 frost joined
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2022/06/20/2022-...will-raku/ 12:02
12:33 frost left 13:23 Kaiepi left 13:24 Kaiepi joined 13:28 frost joined 13:38 jgaz joined 14:01 lizmat left 14:02 kueppo joined 14:09 kueppo left 14:14 Kaiepi left 14:15 Kaiepi joined 14:16 Kaiepi left 14:17 Kaiepi joined 14:21 saint- joined 14:22 frost left 14:30 Kaipei joined 14:34 Kaiepi left 14:36 Kaiepi joined 14:38 Kaipei left 14:57 Kaiepi left 14:59 Kaiepi joined 15:04 Kaiepi left
uzl[m] lizmat++ 15:25
15:53 Kaiepi joined 16:06 Kaiepi left
jgaz I have a large array and I want to test for the presence of a smaller array within its members and return the offset at which the match -- if any -- is found. I'm not sure how to pull that off in Raku. 16:23
Someone provided `@big_array ~~ (**, |@smaller_array, **)` which helps me confirm the smaller array exists. But, I don't get the offset at which the match starts. 16:24
SmokeMachine m: my @big = ^1000; my @small = 5,6,7,8; say @big.rotor(+@small => -(@small - 1)).first: -> @part { @part ~~ @small }, :k 16:28
camelia 5
jgaz SmokeMachine: okay, can you explain that? 16:31
I mean, how it works. 16:32
SmokeMachine m: say ^10 .rotor: 2 => -1
camelia ((0 1) (1 2) (2 3) (3 4) (4 5) (5 6) (6 7) (7 8) (8 9))
SmokeMachine It returns a list of all possibilities of the size of the first array 16:33
And than, gets the `.first` that matches the small array, returning its index (:k) 16:34
jgaz Okay, so given multiple hits for a given sequence, I only get the first result?
SmokeMachine m: say (^10 .rotor: 2 => -1).is-lazy 16:35
camelia False
16:35 dakkar left
SmokeMachine jgaz: yes, only the first one, but you can use grep to get all 16:36
m: say (^10 .rotor: 2 => -1).^name
camelia Seq
SmokeMachine m: my @big = ^1000; my @small = 5,6,7,8; say @big.rotor(+@small => -(@small - 1)).grep: -> @part { @part ~~ @small }, :k
camelia (5)
SmokeMachine m: my @big = |^100 xx 10; my @small = 5,6,7,8; say @big.rotor(+@small => -(@small - 1)).grep: -> @part { @part ~~ @small }, :k 16:37
camelia (5 105 205 305 405 505 605 705 805 905)
SmokeMachine jgaz: 👆 16:38
jgaz gotcha, thanks! 16:39
CIAvash m: my @big = ^1000; my @small = 5,6,7,8; say @big.first(@small.head, :k) if @small ⊆ @big; 16:54
camelia 5
SmokeMachine CIAvash: but for that, you need have only the first element of the small once... 17:00
m: my @big = (5, 5, 5, 5, 6, 7, 8); my @small = 5,6,7,8; say @big.first(@small.head, :k) if @small ⊆ @big
camelia 0
SmokeMachine m: my @big = (5, 0, 5, 0, 5, 0, 5, 6, 7, 8); my @small = 5,6,7,8; say @big.first(@small.head, :k) if @small ⊆ @big 17:01
camelia 0
17:02 jgaz left 17:19 saint- left 17:22 lizmat joined
SmokeMachine m: multi contains([], @, $) { -1 }; multi contains(@big, @small where { @big.head(@small) ~~ @small }, $i = 0) { $i }; multi contains([$f1, *@r], @small, $i = 0) { samewith @r, @small, $i + 1 }; my @big = (5, 5, 5, 5, 6, 7, 8); say @big.&contains([5, 6, 7]) 17:28
camelia 3
17:39 jgaz joined
CIAvash yeah 18:08
maybe if we knew what happens after the index is found, we could come up with another solution. Maybe there is a XY problem, maybe not. 18:25
19:06 jgaz left 19:16 MasterDuke left 19:45 discord-raku-bot left 19:46 discord-raku-bot joined 21:46 discord-raku-bot left 22:08 discord-raku-bot joined
Nemokosch the language that I find similar regarding the learning process is Javascript actually 22:08
gfldex bridgetest 22:10
stevied Is there any way at all I might get the contents of the $?DISTRIBUTION variable from another distribution?
I can get at it if the module in the distribution I want to access has a subroutine that return the `$?DISTRIBUTION` variable. 22:12
might it be possible to inject a subroutine into the external distribution that returns `$?DISTRIBUTION` for that module?
I can get at it if the module in the distribution I want to access has a subroutine that returns the `$?DISTRIBUTION` variable.
gfldex Since you have to compile the sub in some context to get a code object, any compile time variable will point to the compilation context, not the runtime context. So even if you manage to inject at runtime, it would not get you what you want. 22:16
stevied ok, that's what I was thinking but couldn't really put it into words
22:29 discord-raku-bot left, discord-raku-bot joined
oh, this is interesting: docs.raku.org/language/compilation 23:01
Nemokosch Watch Vadim Belman's presentation(s) from last year if this seems interesting for you 23:02
stevied so, one of the reasons I would avoid using rake to run little scripts from the command line is because it's very slow to startup. so but if I were to package them as little precompiled modules, they's run much faster?
Nemokosch Frankly I wasn't ready to take it a year ago
stevied ok
www.youtube.com/watch?v=NYBc3tQEIh4 23:21
that one?
Nemokosch Yep
stevied 6 hours. jesus
Nemokosch I got tired a year ago 😅 23:22
but maybe now I could take it
stevied i'll have to do it in 20 min chunks 23:25
Nemokosch is this the whole thing? 23:27
I remember it wasn't a one-day presentation
but I don't remember the net length
23:44 Kaiepi joined