00:02 arkiuat left
disbot6 <_elcaro_> Typo in the link: What happened to Coma? 00:08
00:15 arkiuat joined 00:25 arkiuat left 00:36 arkiuat joined 00:41 arkiuat left 00:45 arkiuat joined 00:50 arkiuat left 01:04 arkiuat joined 01:08 sibl joined 01:09 arkiuat left 01:14 arkiuat joined 01:30 arkiuat left 01:36 arkiuat joined 01:59 librasteve_ left
korvo What's the correct way to traverse the Match generated by a grammar fragment like (<first> <second>)+ ? It seems like $/.list is not the right move, $/.map(*<first>.made) doesn't work, and $/.map(*[0]<first>.made) sometimes works and sometimes produces Nil. I can't find any good examples of this pattern arising in example grammars with actions. 02:26
02:58 mahlay joined
disbot6 <antononcube> Hmm… I would use .values … 03:04
03:28 sibl left
disbot6 <simon_sibl> is there a similar method than tap in Ruby for Raku ? basically that allow to do some action with the object while still returning the object unmodified ? 05:58
06:15 arkiuat left 06:28 arkiuat joined 06:33 arkiuat left 06:44 arkiuat joined 06:49 arkiuat left
disbot6 <jubilatious1_98524> @korvo assigning to an Array works. 07:07
07:18 arkiuat joined 07:25 arkiuat left 07:56 arkiuat joined 08:01 arkiuat left 08:31 arkiuat joined 08:36 arkiuat left
disbot6 <rcmlz> @simon_sibl you mean like applying map to an array, changing the array and return the original array? 08:50
08:55 dakkar joined
disbot6 <simon_sibl> I mean like @arr.map({$^obj.dosmth.tap({.say})}).sum for example here the tap would print all the object and return the object, not the returned value from the inside code 08:56
08:57 arkiuat joined
disbot6 <nahita3882> docs.raku.org/type/Any#routine_snitch 08:59
09:02 arkiuat left
disbot6 <simon_sibl> m: (^5).map({$^n+1}).snitch.sum 09:07
<Raku eval> Exit code: 1 No such method 'snitch' for invocant of type 'Seq' in block <unit> at main.raku line 1
<simon_sibl> m: use v6.e.PREVIEW; (^5).map({$^n+1}).snitch.sum
<Raku eval> (1 2 3 4 5)
<simon_sibl> thanks ! 09:08
09:16 arkiuat joined 09:21 arkiuat left 09:33 arkiuat joined 09:38 arkiuat left 09:50 arkiuat joined 09:54 arkiuat left 09:58 arkiuat joined 10:03 arkiuat left
disbot6 <rcmlz> weekly: glot.io/snippets/hdjxplylcc 10:03
10:10 librasteve_ joined
disbot6 <librasteve> @elcaro - this is a wordplay on RIP ;-) [but then if you have to explain a joke...] 10:11
10:15 arkiuat joined 10:19 arkiuat left 10:32 arkiuat joined 10:36 arkiuat left 10:48 arkiuat joined 10:52 arkiuat left 11:17 arkiuat joined 11:22 arkiuat left 11:35 arkiuat joined 11:39 arkiuat left 12:00 arkiuat joined 12:04 arkiuat left 12:20 arkiuat joined 12:25 arkiuat left 12:37 arkiuat joined 12:42 arkiuat left 12:56 arkiuat joined
disbot6 <antononcube> @korvo Yes, using $/.values works. 13:06
<antononcube> Here is an example: my grammar MyGrammar { token TOP { (<first> <second>)+ } token first { <alpha>+ } token second { \d+ } } my class MyActions { method TOP($/) { make $/.values.map({ "1:{.<first>} 2:{.<second>}" }).join('; ') } } my $text = 'foo1bar2baz3'; my $match = MyGrammar.parse($text, :actions(MyActions)); say $match.made; # 1:foo 2:1; 1:bar 2:2; 1:baz 2:3 13:07
korvo antononcube: Very nice, thanks! 14:48
jubilatious1: Like, `my @arr = $/;` ? Yes, that does work, thanks. 14:49
FWIW I refactored that production and generated an AST; manipulating the AST is a zero-magic situation. But I appreciate knowing how to handle it in the future. 14:50
14:58 human-blip left 15:00 human-blip joined 15:06 arkiuat left 15:19 arkiuat joined 15:30 arkiuat left 15:45 arkiuat joined 15:54 arkiuat left 15:58 arkiuat joined 17:50 dakkar left 19:56 librasteve_ left 20:06 arkiuat left 20:17 arkiuat joined 20:22 arkiuat left 20:50 arkiuat joined 20:55 arkiuat left 21:23 arkiuat joined 21:28 arkiuat left 21:39 human-blip left 21:41 human-blip joined, arkiuat joined 21:46 arkiuat left 21:48 arkiuat joined 21:53 arkiuat left 22:03 arkiuat joined 22:15 human-blip left 22:17 human-blip joined