🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:04 xelxebar left, patrickz joined 00:08 patrickb left 00:18 lucasb left 00:34 vike left 00:46 pecastro left 01:01 patrickz left
uzl[m] m: my $some-string = "some foo"; dd $some-string.match(/foo/, "string); 01:01
evalable6 (exit code 1) 04===SORRY!04=== Er…
uzl[m], Full output: gist.github.com/6c5e54c8ae14655a38...d091010480
uzl[m] * m: my $some-string = "some foo"; dd $some-string.subst(/foo/, "string"); 01:03
m: my $some-string = "some foo"; say $some-string.subst(/foo/, "string");
evalable6 some string
uzl[m] m: my $some-string = "some foo"; say $some-string.match(/foo/).replace-with("string"); 01:04
evalable6 some string
uzl[m] m: my $some-string = "some foo"; $some-string = $some-string.match(/foo/).replace-with("string"); say $some-string;
evalable6 some string
uzl[m] m: my $some-string = "some foo"; $some-string .= match(/foo/).replace-with("string"); say $some-string; 01:05
evalable6 「foo」
01:24 NODE left 01:25 NODE joined 01:36 Altai-man_ joined 01:38 sena_kun left 01:42 __jrjsmrtn__ left, __jrjsmrtn__ joined 02:10 leont left 02:16 molaf left 02:29 molaf joined 02:51 vike joined 03:09 normanrockwell joined 03:11 normanrockwell left, oneeggeach joined 03:37 sena_kun joined 03:38 Altai-man_ left 03:48 aborazmeh left 04:34 rindolf joined 05:17 oneeggeach left 05:18 oneeggeach joined, oneeggeach left, oneeggeach joined 05:19 oneeggeach left, oneeggeach joined 05:20 oneeggeach left, oneeggeach joined, oneeggeach left 05:21 oneeggeach joined, oneeggeach left, oneeggeach joined 05:22 oneeggeach left, oneeggeach joined 05:23 oneeggeach left, oneeggeach joined 05:24 oneeggeach left, oneeggeach joined, oneeggeach left 05:26 oneeggeach joined 05:31 oneeggeach left 05:36 Altai-man_ joined 05:39 sena_kun left 05:51 regreg left 05:55 Sgeo_ left 05:59 oneeggeach joined 06:01 Sgeo joined 06:05 wamba joined 06:09 oneeggeach left 06:15 molaf left 06:16 regreg joined 06:20 mowcat left 06:22 chloekek joined 06:23 mowcat joined 06:40 chloekek left, mowcat left 07:08 Sgeo left, Sgeo joined 07:23 molaf joined, chloekek joined 07:24 oneeggeach joined 07:26 oneeggeach left 07:35 oneeggeach joined 07:37 sena_kun joined 07:38 Altai-man_ left 07:40 oneeggeach left 08:08 oneeggeach joined 08:14 oneeggeach left 08:32 xinming left 08:33 xinming joined 09:00 xinming left 09:01 xinming joined 09:24 chloekek left 09:31 Poohmaan joined 09:34 Poohman left 09:36 Altai-man_ joined 09:38 sena_kun left
cpan-raku New module released to CPAN! Math::Libgsl::Random (0.0.2) by 03FRITH 09:51
09:53 xinming left, xinming joined 10:08 xelxebar joined 10:10 chloekek joined 10:19 pecastro joined 10:49 lizmat left 11:01 markoong joined 11:15 oneeggeach joined, chloekek left 11:18 regreg left 11:22 cpan-raku left, cpan-raku joined, cpan-raku left, cpan-raku joined 11:27 reach_satori left, reach_satori joined 11:34 vike left 11:37 sena_kun joined 11:38 Altai-man_ left 11:40 leont joined 11:49 APic left 11:50 Poohman joined 11:51 NODE left 11:52 NODE joined 11:53 Poohmaan left
tyil rba: I think I found the issue with duplicate entries in the r* release 12:02
changed a `>>` to a `>` seems to fix it
12:17 regreg joined 12:18 oneeggeach left
leont What is a normal backwards compatibility time around here? I guess min(debian, ubuntu, fedore)? 12:28
12:37 marcusr left, marcusr joined 12:41 mowcat joined 13:00 chloekek joined 13:02 wamba left 13:14 oneeggeach joined 13:20 APic joined
leont I currently have some <2018.06 and <2016.10 code, and am wondering if it makes sense to keep it once the last of the major distros' stable release doesn't need it anymore (Ubuntu LTS in this case) 13:26
13:36 Altai-man_ joined 13:39 sena_kun left 13:52 lucasb joined, oneeggeach left, oneeggeach joined 13:57 oneeggeach left 13:58 oneeggeach joined 14:02 oneeggeach left, oneeggeach joined 14:48 dogbert17 left
lucs Um, no camelia? 15:04
(I'd like to test stuff with "m:")
(privately)
uzl[m] m: say <Hello, World>.contains('Hello', 0); 15:10
evalable6 True
uzl[m] say <Hello, World>.contains(/Hello/, 0);
m: say <Hello, World>.contains(/Hello/, 0);
evalable6 (exit code 1) Cannot resolve caller contains(Li…
uzl[m], Full output: gist.github.com/e50abf9e0db4356eee...cce1a32ce4
uzl[m] ^ When using `contains` with a regex as a needle, a list isn't coerced into a string. Is that the expected behavior? 15:11
15:12 rindolf left
uzl[m] .seen jmerelo 15:19
tellable6 uzl[m], I saw jmerelo 2020-02-26T20:04:44Z in #raku-dev: <jmerelo> tbrowder: that would be OK, I think.
tobs uzl[m]: I don't think this has to do with coercing. The contains method has no candidate for a regex needle. Not on List, not on Cool and not on Str. 15:20
m: "Hello, World".contains(/Hello/, 0)
evalable6
tobs m: say "Hello, World".contains(/Hello/, 0)
evalable6 True
tobs huh?
maybe my rakudo is too old, sorry 15:21
uzl[m] In 2020.02, there are a few candidates for a regex needle
tobs: github.com/rakudo/rakudo/releases/tag/2020.02 15:23
tobs then I can only imagine that the problem is that they're not on Cool but on Str. The mechanism that turns the List into a Str ad-hoc is that the List is Cool.
15:27 oneeggea_ joined 15:30 regreg_ joined, oneeggeach left 15:31 regreg left 15:34 oneeggea_ left, oneeggeach joined
uzl[m] tobs: That makes sense. I wonder if that's how it should be behave though; I'd expect the list to be turned into a string when using a regex too. Not a big deal though since you can always stringify the list before calling contains (with a regex) on it. 15:36
tobs no, I think it should work and it seems easy to add 15:37
15:37 sena_kun joined
tobs you just need the new contains candidates on Cool as well. 15:37
15:37 imcsk8 left
tobs to me it seems like an oversight that they don't exist 15:37
15:39 oneeggeach left, Altai-man_ left, imcsk8 joined 15:47 regreg_ left
tobs uzl[m]: do you want to make a PR? 15:48
15:51 regreg joined 15:59 NODE left 16:00 NODE joined 16:18 aborazmeh joined, aborazmeh left, aborazmeh joined 16:19 xinming-pad joined 16:25 rindolf joined 16:26 xinming-pad left 16:32 aborazmeh left 16:35 NODE left 16:36 NODE joined 16:37 aborazmeh joined, aborazmeh left, aborazmeh joined 16:43 TheAthlete joined 16:45 TheAthlete left
Geth doc: uzluisf++ created pull request #3253:
Document a few 2020.02 additions
16:46
tobs (uzl[m]: I submitted a rakudo PR in the meantime) 16:54
17:11 aborazmeh left 17:14 vike joined 17:18 oneeggeach joined 17:20 vike left 17:28 wamba joined 17:29 vike joined 17:36 Altai-man_ joined 17:38 sena_kun left 17:49 oneeggea_ joined 17:51 oneeggeach left 18:00 reportable6 left 18:02 reportable6 joined 18:06 oneeggea_ left, oneeggeach joined 18:13 oneeggeach left 18:14 oneeggeach joined 18:29 caasih joined 18:31 mowcat left 18:33 ptrcmd joined 18:34 mowcat joined 18:36 aborazmeh joined, aborazmeh left, aborazmeh joined
cpan-raku New module released to CPAN! CSS (0.0.4) by 03WARRINGD 18:39
18:49 aborazmeh left 18:50 oneeggeach left, oneeggeach joined 18:55 oneeggeach left 19:00 lizmat joined 19:02 clarjon1 joined 19:20 oneeggeach joined, wamba left 19:25 b2gills left 19:30 lizmat_ joined 19:34 lizmat left 19:37 chloekek left, sena_kun joined 19:39 Altai-man_ left 19:50 sauvin is now known as Boc 19:53 cognomin_ joined 19:57 cognominal left 20:01 lizmat joined 20:04 lizmat_ left 20:15 Poohmaan joined 20:18 Poohman left, Poohman joined 20:21 Poohmaan left 20:31 lizmat_ joined 20:35 lizmat left 20:41 aborazmeh joined, aborazmeh left, aborazmeh joined 20:46 oneeggeach left 20:50 aborazmeh left 21:01 regreg left, lizmat_ left 21:02 lizmat joined, Doc_Holliwood joined
Doc_Holliwood weekly: stackoverflow.com/questions/598406...3#60479703 21:03
notable6 Doc_Holliwood, Noted! (weekly)
leont Nice! 21:06
rypervenche Wow 21:15
Talk about compact, especially compared to the other languages.
21:16 rindolf left
Doc_Holliwood To be fair, this only works because it's 0s and 1s 21:25
MasterDuke can't you start at something like $n.log2.Int instead of 1? 21:28
21:32 lizmat left 21:33 lizmat joined 21:36 Altai-man_ joined 21:38 sena_kun left 21:43 oneeggeach joined 21:49 rjt_pl joined
rjt_pl p6: say reduce { $^a + $^b }, ^10 21:50
evalable6 45
21:50 oneeggeach left
rjt_pl p6: say reduce { { $^a + $^b } }, ^10 21:51
evalable6 (exit code 1) Too many positionals passed; expected 0 or 1 arguments but got 2
in block <unit> at /tmp/dH6aH5Ooky line 1
rjt_pl I think I'm having a brain fart. Is there a way to have positionals work in inner scopes, like my second silly example? 21:52
Obviously I can assign them to lexical (my) vars or other workarounds, but that sort of defeats the purpose. 21:53
rypervenche p6: [+] ^10 21:56
evalable6 Potential difficulties:
Useless use of [+] in sink context
at /tmp/GQoDIHuVZe:1
------> 03<BOL>08⏏04[+] ^10
rypervenche p6: say [+] ^10
evalable6 45
rjt_pl Emphasis on silly example. That was just to illustrate the problem: using positionals ($^a, etc.) inside of an inner lexical scope. Is it possible? 21:58
22:03 lizmat left, lizmat joined 22:04 hacktor joined
Doc_Holliwood m: say reduce -> $a, $b { { $a + $b } }, ^10 22:07
evalable6 45
Doc_Holliwood make 'em explicit
rjt_pl Ah, the pointy block. That'll do. Thanks. 22:08
Doc_Holliwood MasterDuke: There is some room for cleverness but it does not buy you much. 22:10
MasterDuke ah 22:12
Doc_Holliwood Consider how fast the binary string grows. After a few iterations you reach 111111111 which is already bigger than most n and from there you have to brute force no mather what 22:13
so, 3000 iterations (lets say) or 3020 makes no difference
22:17 xinming left
MasterDuke for $n == 30000020, starting at $n.sqrt.Int save me ~0.3s (e.g., 5.0s instead of 5.3s) 22:18
22:18 xinming joined
MasterDuke but i'm not sure if that's always safe 22:20
a little more math than i'm willing to do on a sunday night
lizmat what's the code?
MasterDuke m: sub a(Int $n) { ($n.sqrt.Int .. Inf).map( *.base(2) ).first( *.Int %% $n, :kv ) }; say a(30000020) 22:21
evalable6 (1583895 110000100000001111100)
MasterDuke m: sub a(Int $n) { ($n.sqrt.Int .. Inf).map( *.base(2) ).first( * %% $n ) }; say a(30000020) # closer to the original code in the SO answer
evalable6 110000100000001111100 22:22
lizmat I wonder if you could combine the .map and the .first into a single .map and a "last" 22:28
Doc_Holliwood lizmat: yes. 22:31
m: (1 .. Inf).first( *.base(2).Str %% 55 ).base(2);
evalable6
Doc_Holliwood m: say (1 .. Inf).first( *.base(2).Str %% 55 ).base(2); 22:32
evalable6 110
Doc_Holliwood I wanted to avoid the double .base(2) 22:33
22:33 lizmat left
MasterDuke it is almost 1s faster though 22:34
22:34 lizmat joined
Doc_Holliwood m: say (1 .. Inf).first( *.base(2) %% 55 ).base(2); 22:35
evalable6 110
lizmat grr... on flaky Wifi, which appears to just disconnect IRC every 30 mins or so
MasterDuke m: sub a(Int $n) { ($n.sqrt.Int .. Inf).map( *.base(2) ).first( * %% $n ) }; say a(30000020); say now - INIT now 22:36
evalable6 110000100000001111100
8.93239298
MasterDuke m: sub a(Int $n) { ($n.sqrt.Int .. Inf).first( *.base(2) %% $n ) }; say a(30000020); say now - INIT now
evalable6 1589372
6.71775519
Doc_Holliwood m: m: sub a(Int $n) { ($n.sqrt.Int .. Inf).first( *.base(2) %% $n ) }; say a(355); say now - INIT now 22:38
evalable6 38
0.00650274
MasterDuke m: sub a(Int $n) { ($n.sqrt.Int .. Inf).map( *.base(2) ).first( * %% $n ).base(2) }; say a(30000020); say now - INIT now 22:39
evalable6 (exit code 1) No such method 'base' for invocant of type 'Str'. Did you mean any of these?
Date
Hash
asec
hash

in sub a at /tmp/yJM9xamCHf line 1
in block <unit> at /tmp/yJM9xamCHf line 1
22:40
MasterDuke m: sub a(Int $n) { ($n.sqrt.Int .. Inf).first( *.base(2) %% $n ).base(2) }; say a(30000020); say now - INIT now 22:41
evalable6 110000100000001111100
6.620736
Doc_Holliwood I'm not sure if that square root thing is correct
MasterDuke doh, the second base is only run once, shouldn't really change runtime
Doc_Holliwood anyway, me bed 22:42
MasterDuke later...
22:46 xinming left, xinming joined 22:51 lucasb left
discord6 <Highlander> Yeah I don't think sqrt is right there 22:53
<Highlander> it's a bit cheesy, but you could start at ($n * 2).base(2).Int
<Highlander> wait no
<Highlander> ignore that lol, very wrong 22:54
rypervenche It's just a way to move up by one in base 2, no? I don't see how any conversion into base 2 would work in that case. I might be missing the logic though.
discord6 <Highlander> My logic was very wrong--I was thinking in reverse 22:55
<Highlander> I think maybe ('1' x $n.chars).parse-base(2) would be a safe starting point 23:00
<Highlander> It will always be less than $n * 2, which is the first place you could find a multiple 23:01
MasterDuke m: say ("1" x 30000020.chars).parse-base(2) # doesn't save all that much work though 23:02
evalable6 255
MasterDuke m: say 2**(30000020.chars)
evalable6 256
MasterDuke m: sub a(Int $n) { (2**($n.chars - 1) .. Inf).first( *.base(2) %% $n ).base(2) }; say a(30000020); say now - INIT now 23:03
evalable6 110000100000001111100
6.8538219
MasterDuke m: sub a(Int $n) { 1 .. Inf).first( *.base(2) %% $n ).base(2) }; say a(30000020); say now - INIT now 23:04
evalable6 (exit code 1) 04===SORRY!04=== Er…
MasterDuke, Full output: gist.github.com/ff1d2ff6b28beb4e68...b58695bfb6
MasterDuke m: sub a(Int $n) { (1 .. Inf).first( *.base(2) %% $n ).base(2) }; say a(30000020); say now - INIT now
evalable6 110000100000001111100
6.8287722
23:05 lizmat_ joined 23:08 lizmat left 23:15 NODE left 23:16 NODE joined 23:36 lizmat joined 23:37 sena_kun joined 23:39 Altai-man_ left, lizmat_ left 23:43 reach_satori left 23:44 NODE left, reach_satori joined 23:45 NODE joined 23:46 Benett left
cpan-raku New module released to CPAN! Getopt::Long (0.1.6) by 03LEONT 23:46
23:47 Benett joined 23:55 Benett left, Benett joined