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:17 kjp joined 00:21 kjp left, kjp joined 00:46 topnep left 00:48 topnep joined 01:54 ACfromTX joined
ab5tract “Follow your curiosities” Trial and error can lead to really interesting learnings 02:46
Also: welcome! 02:47
02:49 topnep left 07:50 dakkar joined
librasteve mr_nice_guy: abandon hope all yea who enter here 07:51
lizmat And yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2025/06/16/2025-...-codified/ 12:53
16:36 habere-et-disper joined 16:43 dakkar left 16:54 disbot1 left, disbot2 joined
habere-et-disper can you unshape an array while keeping it's nested structure ? 17:22
lizmat how many dimensions ? 17:24
habere-et-disper 2
m: my @foo[2;2] = [[1,2],[3,4]];
camelia ( no output )
habere-et-disper i was doing `@foo.rotor(@foo.shape.tail)` which seems a mouthful 17:26
timo m: my @foo[2;2;1] = [[[11],[12]],[[21],[22]]]; my @new; for @foo.pairs { say .raku; @new.ASSIGN-POS(|.key, .value) }; say @new.raku # /cc habere-et-disper 17:38
camelia (0, 0, 0) => 11
(0, 1, 0) => 12
(1, 0, 0) => 21
(1, 1, 0) => 22
[[[11], [12]], [[21], [22]]]
timo i wasn't sure how exactly to get the same behaviour that ASSIGN-POS has out of postcircumfix:<[ ]>
habere-et-disper thanks timo. hmm, that seems even more of a dance. 17:40
timo yeah, a little bit. i was also slightly surprised that there's no trivial way to get an equivalent nested array out of a shaped array (though there may be one that i'm just not seeing) 17:41
though i do think there was some design decision that shaped arrays could just be treated as a linear array of values for some purposes
lizmat m: my @foo[2;2] = [[1,2],[3,4]]; dd @foo; .say for @foo 17:54
camelia Array.new(:shape(2, 2), [1, 2], [3, 4])
1
2
3
4
lizmat iterating over a shaped array will produce all values in turn
m: my @a[2;2] = [[1,2],[3,4]]; my @b = @a.batch(2); dd @b 17:56
camelia [(1, 2), (3, 4)]
lizmat m: my @a[2;2] = [[1,2],[3,4]]; my @b = @a.batch(2)>>.Array; dd @b 17:57
camelia [[1, 2], [3, 4]]
timo batch will not help easily with a three-dimensional (or more) shaped array though 18:12
lizmat indeed, but the question was for 2 dim arrays
timo right
lizmat wonder whether Math::Matrix has a solution for it 18:13
timo it would probably be the best spot to look yeah 18:14
18:18 habere-et-disper left 18:32 habere-et-disper joined 19:12 habere-et-disper left 20:15 habere-et-disper joined 20:48 habere-et-disper left 21:39 habere-et-disper joined 21:42 habere-et-disper left