🦋 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.
uzl[m] I've two versions of Pod::To::HTML. Is it possible to specify a version when using `raku --doc=HTML ...`. 01:49
?
[Coke]_ maybe with raku --M.... --doc ? 01:53
AlexDani` interesting, so previously on constrained systems (like RPi or whatever) it was relatively easy to install rakudo from debian repos 01:55
AlexDaniel but now it does this: 01:55
“rakudo-helper.pl: Reinstalling all perl6 modules ... (1/3) reinstall: perl6-readline”
cool, I mean… I don't even need readline :) 01:56
although, maybe I should be installing `rakudo` instead of `perl6`… 01:57
ah okay, indeed 02:06
that works
jdv79 is there a terse way to do a deep clone? 03:33
AlexDaniel time zef install --/test Cro::ZeroMQ # real34m1.915s 04:06
mkay plan B
jdv79 m: my %h = k => 2; my %h2 = %h.clone; %h<k> = 3; say %h, %h2; 04:08
camelia {k => 3}{k => 2}
jdv79 my $h = {k => 2}; my $h2 = $h.clone; $h<k> = 3; say $h, $h2; 04:08
evalable6 {k => 3}{k => 3}
jdv79 : my $h = {k => 2}; my $h2 = $h.clone; $h<k> = 3; say $h, $h2; 04:09
m: my $h = {k => 2}; my $h2 = $h.clone; $h<k> = 3; say $h, $h2;
camelia {k => 3}{k => 3}
jdv79 anyway, why the diff there?
shouldn't a hash clone be effectively the same regardless of the sigil? 04:10
jnthn jdv79: Assignment from one hash into another is a copying operation (e.g. it iterates the RHS) 09:56
chloekek jdv79: with `my $h = {k => 2};` you create a Scalar containing a Hash, with `my %h = k => 2;` you just create a Hash. 10:04
Scalar implements its own assignment operator, different from the one Hash implements.
chloekek Oh, that is not what is happening here. Nevermind. 10:07
jnthn It is odd that .clone on a Hash looks to not clone the Scalar containers of the values, though.
chloekek Yeah. :P
chloekek p6: my %h = k => 2; my %i := %(%h); %h<k> = 3; say %h, %i; 10:08
camelia {k => 3}{k => 3}
chloekek p6: my %h = k => 2; my %i := %(|%h); %h<k> = 3; say %h, %i;
camelia {k => 3}{k => 2}
chloekek p6: my %h = k => 2; my %i := %|%h; %h<k> = 3; say %h, %i; 10:09
camelia Type check failed in binding; expected Associative but got Junction (any({}, {:k(2)}))
in block <unit> at <tmp> line 1
chloekek p6: my @xs = 1, 2, 3, 4; say (^∞ Z @xs), @xs.map({ $++ => $_ }) 10:14
camelia ((0 1) (1 2) (2 3) (3 4))(0 => 1 1 => 2 2 => 3 3 => 4)
chloekek p6: sub is-prime-2($x) { so $x %% none(2 ..^ $x) }; .say for (1 ..^ 100).grep({ is-prime($_) != is-prime-2($_) }) 10:26
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3sub is-prime7⏏5-2($x) { so $x %% none(2 ..^ $x) }; .say
expecting any of:
new name to be defined
chloekek p6: sub my-prime($x) { so $x %% none(2 ..^ $x) }; .say for (1 ..^ 100).grep({ is-prime($_) != my-prime($_) }) 10:27
camelia 1
chloekek Hmm.
p6: sub my-prime($x) { set((1 .. $x).grep($x %% *)) == 2 }; .say for (1 ..^ 100).grep({ is-prime($_) != my-prime($_) }) 10:32
camelia ( no output )
chloekek p6: sub my-prime($x) { (1 .. $x).grep($x %% *) == 2 }; .say for (1 ..^ 100).grep({ is-prime($_) != my-prime($_) }) 10:34
camelia ( no output )
chloekek p6: sub f($x) { $x «%%« 1 .. $x }; say f(8) 10:43
camelia Bool::True..8
chloekek p6: sub f($x) { $x »%%« 1 .. $x }; say f(8) 10:44
camelia Bool::True..8
chloekek p6: sub f($x) { $x »%%» 1 .. $x }; say f(8)
camelia Bool::True..8
chloekek p6: sub f($x) { $x «%%« 1 .. $x }; .say for f(8)
camelia 1
2
3
4
5
6
7
8
chloekek p6: sub f($x) { $x «%%« (1 .. $x) }; .say for f(8)
camelia True
True
False
True
False
False
False
True
chloekek p6: sub f($x) { [+] $x «%%« (1 .. $x) }; say f(13); say f(10) 10:45
camelia 2
4
chloekek p6: sub my-prime($x) { 2 == [+] $x «%%« (1 .. $x) }; .say for (1 ..^ 100).grep({ is-prime($_) != my-prime($_) }) 10:46
camelia ( no output ) 10:46
chloekek This is super neat 10:47
p6: sub my-prime($x) { 2 == [+] $x «%%« 1 + ^$x }; .say for (1 ..^ 100).grep({ is-prime($_) != my-prime($_) }) 10:48
camelia 2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
theovdh Hi Gurus, in debugger, when typing any name of a variable I get: 10:50
Cannot find method 'has_hook' on object of type NQPMu
suggestions? I use --ll-exception.
tadzik show us the code :) Where are you typing that variable name?
theovdh at the prompt. e.g. 10:51
> $line
called the debugger with 10:54
perl6-debug-m --ll-exception create_fun_count.pl6 --file=out/knmi2.annshm
tadzik ah, the debugger prompt, sorry, I missed that 10:55
are you sure that variable exists though? What if you try something like %*ENV? 10:56
then again, I just get `Variable '$line' is not declared.` then I type in a missing one 10:57
theovdh right. Meanwhile I cleared the .precomp and reran and now I get different results:Strange text after block (missing semicolon or comma?) 10:58
at SETTING::src/core.c/Exception.pm6:62 (/home/theo/rakudo/share/perl6/runtime/CORE.c.setting.moarvm:throw)
followed by lots of lines from other code than my own. 10:59
MasterDuke i'm not sure the rakudo debugger works perfectly right now? 11:01
theovdh Neither am I. I run again without the --ll-exception and get yet other results. It now points at a line in my code that provably does not exist. Weird. 11:03
Altreus in the `start react whenever` idiom, can I return data from the react block to the started promise when I call done? 11:05
jnthn No. Consider the `Promise(supply whenever $foo { emit $value; done; }) idiom instead 11:07
theovdh Found an issue in a file used by my source. Strange, because that line has been in there for months. 11:08
Altreus jnthn: I realise I omitted a possibly important structure wherein the react has two whenevers - how would these combine? currently it is start react{ whenever $timeout { done }; whenever $a-supply { do stuff } } 11:09
jnthn If nothing emits a value, the Promise is kept but with Nil 11:13
SmokeMachine could done accept a value and that value would be the return of the recap? would that make sense? 11:15
Altreus I was hoping to learn that was the case
with done as a return construct for a react
start supply react then? forgive my clumsy pawing at stuff I clearly don't understand 11:16
jnthn SmokeMachine: No
Altreus: Literally how I wrote it
Altreus Yep I definitely don't understand so I will try it and see instead 11:17
jnthn Example in the wild: github.com/croservices/cro-http/bl...t.pm6#L431
SmokeMachine s/recap/react/ 11:17
Altreus this way I will learn and understand in future
jnthn Any Supply can be coerced into a Promise, which is what's happening here 11:18
And it will keep the Promise when the Supply is done, break it if the Supply quits, and will take the final emit as the value of the Promise
Altreus Seems like I can use a supply just like a react but the framing of it changes
SmokeMachine jnthn: ok... but I'm curious... technical impossibility or design choice?
jnthn SmokeMachine: It'd break the Supply API completely 11:19
Altreus Is there a benefit to using start react over Promise(supply)?
jnthn Altreus: `start react` is much better when you do not want to produce a value, 'cus you get the sink context `start` semantics
SmokeMachine m: say await Promise(supply { emit 42 })
camelia 42
jnthn Altreus: Whereas with the Promise(supply ...) idiom you had better be awaiting it, otherwise the usual chance of lost errors etc. 11:20
SmokeMachine m: say await supply { emit 42 }.Promise
camelia 42
jnthn Yes, you can also coerce at the end like that :) 11:20
They're equivalent; I tend to prefer to state the intention up front, though, so then when I read the supply block I know the end goal
SmokeMachine jnthn: era the parenthesis required? 11:26
s/era/are/
m: say await Promise supply { emit 42 }
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say await Promise7⏏5 supply { emit 42 }
expecting any of:
infix
infix stopper
postfix
statement end
Altreus Like this? github.com/myisha/p6-zoe-voteban/b...ban.p6#L67 11:27
oh 11:28
I missed a brace
jnthn SmokeMachine: Yes, 'cus that's how coercions look 11:29
SmokeMachine jnthn: yes... makes sense...
jnthn Altreus: I think you forgot a `done` somewhere 11:30
Probably after the emit
xfix m: say Promise 11:32
camelia (Promise)
SmokeMachine m: say Promise()
camelia (Promise(Any))
Altreus ah emit and also done 11:34
wait, if I don't call done, what happens if I emit again? 11:35
jnthn The first emit's value is discarded, and the latest one used as the Promise result 11:36
Altreus So done keeps the promise, not emit 11:38
right :)
jnthn Correct
The implementation is quite short: github.com/rakudo/rakudo/blob/mast...rs.pm6#L42 11:39
xfix m: say "04r07a08i09n12b13o06w"; 12:18
camelia 04r07a08i09n12b13o06w
AlexDaniel hmmm 12:37
AlexDaniel I mean… this shouldn't be allowed 12:43
ah, wait, it should be because camelia is using that
I think colors are stripped on #moarvm but not here 12:44
yeah
jnthn Does anyone know where ecosystem-api.p6c.org/errors.json lives these days? I'm trying to figure out why a couple of modules aren't being indexed... 12:53
AlexDaniel rba: ↑ ? 13:56
samcv: what's github.com/perl6/Atom-as-a-Perl6-IDE ? Why is it not part of the docs?
rba jnthn: I run ecosystem-api.p6c.org 14:39
jnthn: I will check later today what is not updating. 14:40
jnthn: Is this still widely used? It's used by older versions of zef. Or are there other places where this is used? 14:41
jnthn rba: Ah, I wasn't aware of the new version. The thing is that the Raku/ecosystem repository links to it 14:43
jnthn rba: Ideally it'd link to wherever the new place is 14:44
rba: github.com/Raku/ecosystem#generated-file specifically 14:45
I'm looking for the new URL for the errors.json
chloekek rba: I crawl the ecosystem api every hour, but not the errors file. 14:47
To create an index of all versions of all distributions with their hashes.
rba is afk now an will later check ecosystem-api.p6c.org 15:06
patrickb o/ 15:13
m: sub m() { { return 5; LEAVE {say 'L'} } }; say m();
camelia L
The 'ForeignCode' class is a Rakudo-specific
implementation detail and has no serviceable parts inside
patrickb ^ I can't explain that behavior. Not sure it's a bug or missing understanding on my side. Comments welcome!
jnthn Bug, looks like 15:14
patrickb jnthn: OK. I'll create an issue. Thanks for confirming! 15:15
dakkar patrickb: might be related to github.com/rakudo/rakudo/issues/2380 15:25
`LEAVE` and `return` interact in weird ways currently 15:26
patrickb bisectable6: sub m() { { return 5; LEAVE {say 'L'} } }; say m(); 15:30
bisectable6 patrickb, Bisecting by output (old=2015.12 new=9429728) because on both starting points the exit code is 0
patrickb, bisect log: gist.github.com/62c5ba77f66af867b9...08cff7736f 15:31
patrickb, There are 10 candidates for the first “new” revision. See the log for more details
dakkar patrickb: I'm adding a link to that bisectable in the issue 15:34
patrickb dakkar: I think that bisect is tracing the wrong issue. I'm currently trying to find out how to make bisectable search the right one... 15:35
patrickb bisectable6: help 15:35
bisectable6 patrickb, Like this: bisectable6: old=2015.12 new=HEAD exit 1 if (^∞).grep({ last })[5] // 0 == 4 # See wiki for more examples: github.com/Raku/whateverable/wiki/Bisectable
dakkar refrains from linking
patrickb bisectable6: old=153f133bc2a159a85250479e3b83f0784a741df8 new=HEAD sub m() { { return 5; LEAVE {say 'L'} } }; say m(); 15:37
bisectable6 patrickb, Bisecting by output (old=153f133 new=9429728) because on both starting points the exit code is 0
patrickb, bisect log: gist.github.com/9c9ae9772d7efe087e...668a7ac320
patrickb, (2017-12-13) github.com/rakudo/rakudo/commit/9d...a5f9e9c52f
dakkar I'm going to hazard a guess, that that commit is not really relevant to this problem 😕 15:38
(if it were a simple problem to pin down, it would have been fixed by now, I know)
dakkar m: sub foo() { { LEAVE { 5 }; return 1 } }; say foo(); 15:40
camelia WARNINGS for <tmp>:
1
Useless use of constant integer 5 in sink context (line 1)
dakkar ah right
m: sub thing() { return 5 }; sub foo() { { LEAVE { thing() }; return 1 } }; say foo();
camelia 5
dakkar bisectable6: sub thing() { return 5 }; sub foo() { { LEAVE { thing() }; return 1 } }; say foo();
bisectable6 dakkar, Bisecting by output (old=2015.12 new=9429728) because on both starting points the exit code is 0
dakkar, bisect log: gist.github.com/a2b4b02907ac0198a9...0bf5d890cf 15:41
dakkar, There are 10 candidates for the first “new” revision. See the log for more details
patrickb bisectable6: old=c8438e6afe311311a5be0c5c69bff7b2e1a1a3e9 new=HEAD sub m() { { return 5; LEAVE {say 'L'} } }; say m(); 15:43
bisectable6 patrickb, Bisecting by output (old=c8438e6 new=9429728) because on both starting points the exit code is 0 15:44
patrickb, bisect log: gist.github.com/adf5053050f00ffe3e...ea591766ac
patrickb, (2018-12-31) github.com/rakudo/rakudo/commit/58...c9170af9e7
dakkar as a random point of reference, `--optimize=0` doesn't change the result 15:45
AlexDaniel 6c: sub m() { { return 5; LEAVE {say 'L'} } }; say m(); 15:46
committable6 AlexDaniel, gist.github.com/77da4633c3494bfd43...3b46f04b69
AlexDaniel oh that identity issue :D 15:47
dakkar yeah, it's a "fun" one, isn't it?
AlexDaniel 6c: gist.github.com/AlexDaniel/3790373...b73c13c90b 15:49
committable6 AlexDaniel, gist.github.com/437bc3541029c32c55...888d2ff9ba 15:50
AlexDaniel dakkar, patrickb: it's the same issue 15:51
AlexDaniel bisect: old=2018.12 gist.github.com/AlexDaniel/3790373...b73c13c90b 15:52
bisectable6 AlexDaniel, Bisecting by output (old=2018.12 new=9429728) because on both starting points the exit code is 0
AlexDaniel, bisect log: gist.github.com/64479f7c06604d0232...56eb213c3e 15:53
AlexDaniel, (2018-12-31) github.com/rakudo/rakudo/commit/58...c9170af9e7
patrickb bisectable6: old=2018.06 new=2018.08 sub m() { { return 5; LEAVE {say 'L'} } }; say m();
bisectable6 patrickb, Bisecting by output (old=2018.06 new=2018.08) because on both starting points the exit code is 0
AlexDaniel c: 588037f065b^,588037f065b gist.github.com/AlexDaniel/3790373...b73c13c90b
committable6 AlexDaniel, ¦588037f065b^: «left␤identity␤left␤42␤» ¦588037f: «left␤The 'ForeignCode' class is a Rakudo-specific␤implementation detail and has no serviceable parts inside␤left␤42␤»
bisectable6 patrickb, bisect log: gist.github.com/3b7acf6615179b5d22...cbf3a47e7d
patrickb, (2018-07-09) github.com/rakudo/rakudo/commit/8d...6b7f7d03f1
AlexDaniel see github.com/rakudo/rakudo/issues/23...-601258487 15:54
dakkar I have the feeling that the commit you linked causes only a part of the problem 15:55
dakkar the last value from a LEAVE block still clobbers the return value from the containing (non-sub) block 15:56
patrickb I linked to another commit and bisect that shows when it moved from returning 0 to returning the identity thing
dakkar that "return value decont" looks more related, yes; then again, the last release with the behaviour I expect was 2016.05 according to gist.github.com/Whateverable/77da4...3b46f04b69 15:58
MasterDuke bisectable6: old=2016.05 new=2016.06 sub m() { { return 5; LEAVE {say 'L'} } }; say m(); 16:00
bisectable6 MasterDuke, Bisecting by output (old=2016.05 new=2016.06) because on both starting points the exit code is 0
MasterDuke, bisect log: gist.github.com/8f9e119ebedecb328f...0eed12e826
MasterDuke, There are 10 candidates for the first “new” revision. See the log for more details
patrickb I find it interesting that this works fine in the REPL... 16:04
dakkar patrickb: it doesn't "work fine" in my REPL: `LEAVE` still clobbers `return` 16:06
(when the last statement inside LEAVE has a result, at least) 16:07
patrickb dakkar: This is the output I get (2020.02.1 REPL) 16:10
nopaste.linux-dev.org/?1295168
dakkar yes 16:11
try my example: «sub thing() { return 5 }; sub foo() { { LEAVE { thing() }; return 1 } }; say foo();»
I would expect it to print 1 16:12
it prints 5
patrickb Oh! That's definitely not right!
dakkar what I think is happening: LEAVE/return interact badly, *plus* on some versions `say` has a weird return value 16:13
MasterDuke well, the repl also has lots of known issues by itself 16:16
sjn o/ 17:01
anyone here know what happened to the IRC->Telegram bridge that was set up here? It seems to have disconnected on March 6th... 17:02
rbt Is there an obvious reason why the String::CRC32 is so slow? It gets about 200kB/sec throughput. I'm seeing a ton of list related work in a simple profile. 18:01
rbt.ca/profile-1584640224.1384053.html#/routines
jnthn It'd probably be faster to do a boring C-style for loop over the Blob instead of .list'ing it 18:10
Also maybe a native type in $crc would help too
*on
wildtrees ok have an I believe an array of arrays from a database query, "for @rows[0] { .say }" and/or "for @rows.head { .say }" is just printing out the array as [something 1 2 3] instead of on each line, what gives or how do I change/fix that? 18:35
moritz try for @rows[0].list { ... } 18:40
wildtrees moritz, yeap that works fine now, thanks :) 18:42
is that a scalar context or something? 18:43
moritz mumbles something about scalar containers
wildtrees oh 19:04
rbt @jnthn That helps. Gives about a 70% improvement in performance (up to about 700kB/sec). 22:26
MasterDuke rbt: what did you try? for me, making everything 'int' seems to help, but not switching to a c-style loop 22:33
timotimo 33% time spent in GC isn't very good; i wonder what it's like after that 70% improvement 23:30
MasterDuke hm. i get 11% in gc stock, 15% in gc using native ints (though total time went from 10.5s to 6s) 23:50
MasterDuke don't know exactly how they were testing, i just did `use String::CRC32; say String::CRC32::crc32("abcdefghijklmnopqrstuvwxyz0123456789~!#^_+;:./>?" x 100_000)` 23:51