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:52
spider-pig left
01:47
guifa joined
05:33
swaggboi left
05:43
Summer left,
Summer joined
06:29
swaggboi joined
06:48
guifa left,
thowe left
06:49
thowe joined,
guifa joined
|
|||
rcmlz | done | 10:14 | |
12:20
Summer left,
Summer joined
12:51
Summer left,
Summer joined
13:21
Summer left
13:22
Summer joined
13:52
Summer left
13:53
Summer joined
14:23
Summer left,
Summer joined
14:53
Summer left
14:54
Summer joined
15:24
Summer left
15:25
Summer joined
15:55
Summer left,
Summer joined
16:25
Summer left
16:26
Summer joined
16:56
Summer left
16:57
Summer joined
17:02
swaggboi left
17:27
Summer left,
Summer joined
17:38
swaggboi joined
17:57
Summer left
17:58
Summer joined
18:28
Summer left
18:29
Summer joined
18:59
Summer left,
Summer joined
19:30
Summer left,
Summer joined
20:00
Summer left
20:01
Summer joined
20:30
swaggboi left
20:31
Summer left,
Summer joined
20:56
mcmillhj joined
|
|||
mcmillhj | What is the best way to map over two elements of an array at the same time (with overlaps)? For example given `[1, 2, 3, 4, 5]` you would produce `(1 2) (2 3) (3 4) (4 5)`. I had been using `@a Z a.tail(* - 1)` but wasn't sure if there a simpler / more concise way to do this? | 21:00 | |
21:02
Summer left
|
|||
mcmillhj | Maybe something with rotor? | 21:02 | |
21:02
Summer joined
|
|||
nemokosch | yep | 21:02 | |
first off, @a Z @a.skip is a direct improvement | |||
but the OG version would be @a.rotor(2 => -1) | |||
mcmillhj | shoot, I missed that in the docs. `@a.rotor(2 => -1)` is what I was looking for. | 21:03 | |
nemokosch | there is a good video about tricks like this, one sec | ||
www.youtube.com/watch?v=LvFTyvYM-ds | |||
mcmillhj | oooh, thank you ! | ||
22:14
swaggboi joined
|
|||
mcmillhj | Sorry, another question. Is there a way to apply the reduction meta operator from the right? So if I have an array [1,2,3] I would get 2-3=1, 1-1=0 | 23:03 | |
oops, 2-3=-1, 1-1 = 2 | 23:05 | ||
oops, 2-3=-1, 1- -1 = 2 | |||
nemokosch | the associativity of the operator decides | 23:12 | |
23:27
mcmillhj left
|