»ö« #raku and #raku-dev are OPEN FOR BUSINESS | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by mst on 15 October 2019.
00:00 aborazmeh joined, aborazmeh left, aborazmeh joined, marcusr left, marcusr joined, marcusr left, marcusr joined 00:08 |oLa| left, Sgeo left, |oLa| joined 00:09 Sgeo joined 00:19 spacedbat left, Hotbees left, ChoppedBacon left, Bucciarati left 00:24 spacedbat joined, Hotbees joined, ChoppedBacon joined, Bucciarati joined 00:31 pecastro left 00:48 spacedbat left, Hotbees left, ChoppedBacon left, Bucciarati left 00:51 rindolf left 00:53 __jrjsmrtn__ joined 00:54 spacedbat joined, Hotbees joined, ChoppedBacon joined, Bucciarati joined 00:55 _jrjsmrtn left, nightfrog joined 00:56 AlexDaniel joined, AlexDaniel left, AlexDaniel joined 00:57 rindolf joined 01:01 aborazmeh left 01:16 jeromelanteri joined 01:48 spacedbat left, Hotbees left, ChoppedBacon left, Bucciarati left 01:49 rindolf left 01:54 spacedbat joined, Hotbees joined, ChoppedBacon joined, Bucciarati joined 02:02 khisanth_ left 02:16 khisanth_ joined 02:33 molaf left 02:46 molaf joined 02:48 spacedbat left, Hotbees left, ChoppedBacon left, Bucciarati left 02:53 spacedbat joined, Hotbees joined, ChoppedBacon joined, Bucciarati joined 03:01 wildtrees left 03:45 jeromelanteri left 03:56 Cabanossi left 04:02 Cabanossi joined 04:07 WCtwo joined, reach_satori left 04:16 WCtwo left 04:44 molaf left 04:55 rindolf joined 05:31 marcusr left 05:32 marcusr joined 05:48 spacedbat left, Hotbees left, ChoppedBacon left, Bucciarati left, Bucciarati joined, Hotbees joined 05:49 ChoppedBacon joined, spacedbat joined 05:52 quester left 05:54 quester joined 05:56 quester_ joined 06:00 quester left 06:05 quester_ left 06:06 quester_ joined 06:10 quester_ left 06:14 gabiruh left 06:36 HoboWithAShotgun joined 06:38 Doc_Holliwood left 06:57 domidumont joined 07:20 someuser joined 07:23 go|dfish joined 07:31 HoboWithAShotgun left 07:39 wamba joined 07:47 Cabanossi left 07:49 Cabanossi joined 07:58 marcusr left 08:20 reach_satori joined 08:25 cgfbee joined 08:39 dakkar joined, wamba left 08:56 sena_kun joined 09:01 afresh1 left, pecastro joined 09:11 wamba joined 09:28 Altai-man_ joined 09:31 sena_kun left 10:19 gabiruh joined 10:39 mowcat joined 11:06 gabiruh_ joined 11:07 gabiruh left 11:08 tobs joined 11:29 sena_kun joined 11:31 Altai-man_ left 12:19 jeromelanteri joined 12:35 someuser left 12:39 AlexDaniel left 12:41 someuser joined 12:50 jeromelanteri left 13:04 wamba left 13:11 user3 joined
user3 p6: say %(1=>(2,3)).values.flat 13:11
evalable6 ((2 3))
user3 why doesn't that flatten 13:12
13:12 lucasb joined
user3 p6: sub s { { state $i++; } }; put s; put s 13:13
evalable6 0
0
user3 why is "state" ignored?
jnthn Because state works per closure, and your {...} is a closure, cloned at returned from the sub 13:14
user3 ok, so it's not like C static
jnthn m: sub s { { state $i++ } }; my $s1 = s; say $s1(); say $s1();
evalable6 (exit code 1) No such method 'CALL-ME' for invocant of type 'Int'
in block <unit> at /tmp/biYAZpiPis line 1
jnthn No 13:15
Ah, though...it's a bare block there so less useful :)
m: sub s { return { state $i++ } }; my $s1 = s; say $s1(); say $s1();
evalable6 0
1
jnthn That's what I wanted to show
m: sub s { return { state $i++ } }; my $s1 = s; my $s2 = s; say $s1(); say $s2(); say $s1(); say $s2();
evalable6 0
0
1
1
jnthn That's why you can use `state` in a `for` loop and it's just scoped to that iteration 13:16
13:18 cpan-raku left, cpan-raku joined, cpan-raku left, cpan-raku joined 13:29 Altai-man_ joined, user3 left 13:32 sena_kun left 13:34 wamba joined 13:35 reach_satori left 14:24 rindolf left 14:25 xelxebar joined 14:30 AlexDaniel joined, AlexDaniel left, AlexDaniel joined 14:39 molaf joined 14:47 reach_satori joined 15:07 wamba left 15:29 sena_kun joined 15:31 Altai-man_ left 15:36 someuser_ joined 15:38 someuser left 15:58 rindolf joined 16:24 someuser_ left 16:25 domidumont left 16:29 JBmc joined 16:34 someuser joined 16:41 JBmc left 16:55 wamba joined 17:08 domidumont joined 17:09 someuser left 17:29 wamba left 17:31 sena_kun left 17:37 dakkar left 17:38 afresh1 joined 17:41 someuser joined 17:42 lucasb left 18:07 wamba joined 18:11 domidumont left 18:18 patrickb joined 18:20 wamba left 18:30 wamba joined 18:31 wildtrees joined 18:32 wamba left 18:44 molaf left 19:16 patrickb left 19:23 patrickb joined 19:27 |oLa| left 19:28 sauvin left 19:35 rindolf left 19:46 wamba joined 19:52 Actualeyes left 20:11 mowcat left 20:13 ufobat__ joined 20:17 ufobat_ left 20:20 Woodi joined 20:53 |oLa| joined 20:55 molaf joined 21:02 |oLa| left 21:05 wamba left 21:06 wamba joined, john_parr joined 21:09 john_parr left 21:17 someuser left 21:31 TreyHarris joined 21:51 go|dfish left 22:05 go|dfish joined 23:19 wamba left 23:44 pecastro left