🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:52 jpn joined 00:57 jpn left 01:14 hulk joined, kylese left 01:18 derpydoo joined 02:05 jpn joined 02:10 jpn left 02:15 hulk left, kylese joined 02:51 human-blip left 03:54 jpn joined 03:59 jpn left 04:30 kylese left 04:32 kylese joined 04:46 human-blip joined 05:01 yeahitsme joined, jpn joined 05:06 jpn left 05:29 Sgeo left 05:30 kylese left 05:31 kylese joined 05:39 Aedil joined 06:02 floyza left 06:17 jpn joined 06:22 jpn left
antononcube Here uploaded the first version of “WWW::YouTube” : raku.land/zef:antononcube/WWW::YouTube 07:02
07:17 jpn joined 07:21 jpn left 07:58 dakkar joined 08:05 lichtkind joined 09:20 wayland76 joined 09:24 jpn joined
grondilu m: proto foo($) { gather {*} }; multi foo(Int $x) { take $x + 1 }; multi foo(Str $x) { take $x.flip }; foo(35) 09:39
camelia ( no output )
grondilu ^didn't this use to work?
factorising the gather in the proto, that is 09:40
Voldenet bisect: proto foo($) { gather {*} }; multi foo(Int $x) { take $x + 1 }; multi foo(Str $x) { take $x.flip }; foo(35) 09:41
bisectable6 Voldenet, Will bisect the whole range automagically because no endpoints were provided, hang tight
Voldenet we can see if that used to work
bisectable6 Voldenet, ¦6c (90 commits): «» 09:42
Voldenet, Nothing to bisect!
Voldenet right 09:44
bisect: proto foo($) { gather {*} }; multi foo(Int $x) { take $x + 1 }; multi foo(Str $x) { take $x.flip }; .say for foo(35)
bisectable6 Voldenet, Will bisect the whole range automagically because no endpoints were provided, hang tight
wayland76 I ran some code in a container on github, and it said: Function 'Resource::Distribution' needs parens to avoid gobbling block (or perhaps it's a class that's not declared or available in this scope?)
bisectable6 Voldenet, ¦6c (90 commits): «» 09:45
Voldenet, Nothing to bisect!
wayland76 So I tried "use Resource::Distribution", and it said: Could not find Resource::Distribution in
Then I tried zef install Resource::Distribution, and it said: Could not find Resource::Distribution in: 09:46
Any ideas?
Voldenet grondilu: doesn't seem that it used to work ever, but I see no reason why it shouldn't 09:51
m: proto foo($) { CATCH { default { say 'foo'; }}; {*} }; multi foo(Int $x) { die; }; foo(42) 09:53
camelia foo
grondilu it was at least discussed few years ago. Can't recall if it worked at the time but I lean towards stating it did. 10:02
10:02 derpydoo left
grondilu I think it was used somewhere on rosettacode 10:03
10:05 jpn left
Voldenet m: proto foo($) { gather { take 1; {*}; take 5 }; }; multi foo(Int $x) { take $x + 1 }; multi foo(Str $x) { take $x.flip }; .say for foo(35) 10:11
camelia 1
5
Voldenet m: proto foo($) { gather { take 1; take {*}; take 5 }; }; multi foo(Int $x) { $x + 1 }; multi foo(Str $x) { take $x.flip }; .say for foo(35) 10:13
camelia 1
Nil
5
Voldenet m: proto foo($) { my $n = {*}; gather { take 1; take $n; take 5 }; }; multi foo(Int $x) { $x + 1 }; multi foo(Str $x) { take $x.flip }; .say for foo(35)
camelia 1
36
5
Voldenet so it seems that {*} doesn't work within gather at all 10:14
m: proto foo($) { gather { take 1; take {*}; take 5 }; }; multi foo(Int $x) { say "called foo(Int)"; $x + 1 }; multi foo(Str $x) { take $x.flip }; .say for foo(35)
camelia 1
Nil
5
Voldenet m: proto foo($) { my $n = {*}; gather { take 1; take $n; take 5 }; }; multi foo(Int $x) { say "called foo(Int)"; $x + 1 }; multi foo(Str $x) { take $x.flip }; .say for foo(35) 10:15
camelia called foo(Int)
1
36
5
Voldenet eh, so, it isn't even called
10:18 jpn joined
wayland76 To answer my question: It's Distribution::Resource, not Resource::Distribution :p 10:22
10:26 jpn left 10:43 jpn joined 10:51 jpn left 10:52 jpn joined 11:33 jpn left 11:52 jpn joined 11:57 jpn left 12:26 wayland joined
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2025/04/22/2025-...ompletion/ 12:26
12:26 wayland76 left 12:42 jpn joined 13:08 jpn left 13:12 jpn joined 13:16 jpn left 13:20 human-blip left, human-blip joined 13:22 jpn joined
tbrowder lizmat++ 13:24
note the reddit comment about raku having great regexes, and the perl person said perl has it now. but they didn't give any time comparisons. 13:27
13:27 jpn left
timo do you mean in terms of performance? 13:30
antononcube "JSON::Fast" cannot parse this: from-json('[23, 32, 31.]') . Is there a workaround? 13:35
I will file an issue soon...
13:36 jpn joined
timo oh, are floating points without a digit after the . allowed? 13:38
do you happen to have a link to the spec on hand?
antononcube @timo Yeah, I should have clarified more. 13:40
tbrowder yes, i've just seen comps on debian which may not have latest perl with raku regexes
antononcube @timo Wolfram Language (aka Mathematica) parses that JSON string. R and Python do not.
timo JSON::Fast does have some standards-nonconformant options already, for NaN and Inf and -Inf IIRC 13:41
antononcube @timo LLM services (e.g. Google's Gemini) occasionally return JSON vectors that that floating point without following digit. 13:42
tbrowder m: perl 13:43
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
perl used at line 1
antononcube I can replaces those with some regex matching/substitution, but then that has to be in done in all LLM packages. (Just in case...)
13:43 jpn left
Voldenet > '[23, 32, 31.]' 13:45
this is not proper json
antononcube Ok. I still need it to be parsed. (Because LLMs return results in that form.) 13:46
tbrowder latest perl is 5.40.2; my deb has perl 5.32.1
:(
Voldenet it is proper javascript 13:47
is there Inline::Javascript? 13:48
eh, nope :(
tbrowder erg, latest is 5.41.12 per perl.org 13:51
Voldenet `JSON.stringify([23, 32, 31.])` would solve the problem if you can get away with using nodejs
dakkar m: '[10,12.4,13.]'.subst(/(\d+)\.<!before \d>/, {"{$0}.0"}, :g)
camelia ( no output )
tbrowder nope, 5.40.2
dakkar m: say '[10,12.4,13.]'.subst(/(\d+)\.<!before \d>/, {"{$0}.0"}, :g)
camelia [10,12.4,13.0] 13:52
Voldenet m: say (run <nodejs -e>, "console.log(JSON.stringify([23, 32, 31.]))", :out).out.slurp
camelia
Voldenet yeah of course, there's no nodejs
dakkar (it's not a real solution, but then you're getting random strings out of an LLM…)
antononcube @dakkar Yes, that kind of solution I was going to put in the package for the most frequent offender. (Gemini.) 13:53
LLM embeddings, though, are not random strings. They are supposed to reliably give vectors (in whatever format.) 13:54
14:48 jpn joined 14:57 jpn left 15:12 jpn joined 15:18 jpn left 15:22 jpn joined 15:27 jpn left
grondilu m: my Set[Int] %stuff{Rat}; %stuff{355/113} (-)= Set[Int].new: 32; 15:30
camelia Type check failed in assignment to element of %stuff; expected Set[Int] but got Set (set())
in block <unit> at <tmp> line 1
grondilu ^what's wrong with the above? 15:31
m: my Set[Int] %stuff{Rat}; %stuff{355/113} = Set[Int].new: 32;
camelia ( no output )
grondilu m: my Set[Int] %stuff{Rat}; %stuff{355/113} (|)= Set[Int].new: 32;
camelia ( no output )
15:31 jpn joined
grondilu is the empty set loosing its constraints or something? 15:31
m: my Set[Int] %stuff{Rat}; %stuff{355/113} (|)= Set[Int].new: 32; %stuff{355/113} (-)= Set[Int].new: 32; 15:32
camelia ( no output )
grondilu m: my Set[Int] %stuff{Rat}; %stuff{355/113}.=new; %stuff{355/113} (|)= Set[Int].new: 32; 15:33
camelia ( no output )
grondilu hum... so I needed to instantiate it first
kind of annoying, but ok 15:34
FWIW I'm planning to use `has Set[square] %!pieces{Piece}` in my chess module to keep track of the location of various types of pieces. 15:35
(hopefully improving moves generation speed) 15:36
wow, trying to parse a bunch of games with this new addition I got: 15:37
MoarVM panic: Internal error: zeroed target thread ID in work pass
it seemed to fare well for a few dozen games until that happened. 15:38
that's not going to be easy to debug lol 15:39
15:42 jpn left 16:08 human-blip left 16:09 human-blip joined
grondilu hard to reproduce too. I've just tried again and this time it went through. 16:22
librasteve i occasionally get the same MoarVM error in the Air project 16:23
grondilu you can't reliably reproduce it either? 16:26
16:40 human-blip left 16:42 human-blip joined 16:48 dakkar left
timo it's an error that usually happens when you do stuff from multiple threads that's not thread-safe, or if you're somehow corrupting the memory of the process. or there's a moarvm bug, of course, always possible 16:54
16:54 human-blip left
timo i can whole-heartedly recommend recording execution of your program with rr and its "chaos mode" because even if you catch it in GDB with a breakpoint in MVM_oops or MVM_panic, it's extremely difficult to figure out from the end state what actually caused the issue 16:55
16:55 human-blip joined
timo grondilu: i can try to assist 16:56
grondilu what's rr? 16:59
timo mozilla's rr "record and replay"
fast lightweight multi-process recording and forwards and backwards debugging
grondilu I'm pretty sure this part of the code I was running was not multithreaded, though maybe rakudo creates threads automatically? 17:00
timo there are cases, like using Proc::Async or asynchronous I/O in general, but that usually doesn't cause this particular problem
i think precompilation might start threads 17:01
anything involving NativeCall? 17:02
grondilu nope 17:03
I've had this failure after trying to implement the mixed representation of the board. I can't quite push right now, but here is the relevant part for that mixed representation: gist.github.com/grondilu/851c09ba5...3c76c93ee4 17:05
it's all the Set stufu
*stuff
timo are the chess games that you are parsing easy to download as well? 17:07
17:07 [Coke] left
grondilu www.pgnmentor.com/files.html 17:08
also they are in the resources dir of my repo
timo cool 17:09
grondilu just tried again, got 'MoarVM panic: Internal error: invalid thread ID -1241305976 in GC work pass' this time 17:11
timo great, a repro!
grondilu but it's always happening at a different game 17:12
and sometimes not happening at all 17:13
timo right, as long as it does happen some high amount of the time it'll be useful
that error happens when we encounter invalid data in memory during a run of the GC
timing of GC runs can depend on different factors
grondilu do you want me to push what I have now, even though it's quite messy?
timo yeah, you can just put it in a throw-away branch 17:14
grondilu I suck at dealing with git branches
timo i can do it together with you
grondilu rn I just have a master branch
should I create a moarvm-error? 17:15
timo for example, yeah. you can `git switch -c moarvm-error` to create a new branch of that name
after switching you can then make your commit just like you're used to 17:16
grondilu ok
timo we can later go back to master and put all the changes from the commit into your working copy, so it will be as if you never committed
grondilu how do I push to github, though? 17:17
timo ok first of all you'll want to use `git push -n ...` for "dry-run" which will show you what it would do but doesn't do it, so you can be sure you got the command right
it should be fine to just `git push origin moarvm-error`
grondilu so first I try `git push -n origin moarvm-error`? 17:18
timo yup
i'd also like to have your exact `rakudo --version` just in case i can't reproduce it on my currently built version
grondilu seems like the push went well 17:19
Welcome to Rakudo™ v2025.03-242-ge494d4d80.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2025.03-13-gb405e940e.
stand by for the command that produced the error 17:20
timo ok cool i see a bunch of changes from the commit
grondilu raku -Ilib -MChess{,::Games} -e 'say .moves>>.LAN for Chess::Games::load slurp' < resources/masters/Morphy.pgn
timo wonderful, i get the crash 17:21
grondilu cool, I hope that'll help
timo i do have to go AFK for a bit before i can really get started 17:22
grondilu no-worry
17:27 [Coke] joined 17:50 eseyman left 18:12 abraxxa-home joined 18:15 PipStuart left 18:18 abraxxa-home left 18:34 abraxxa-home joined, abraxxa-home left 18:36 abraxxa-home joined 19:14 yeahitsme left
timo grondilu: i think i have a patch for moarvm that fixes the bug you found 19:30
congrats, that was a well hidden one :D
librasteve timo ++ 19:31
timo can't come up with a short reproducer of the bug off hand 20:00
20:00 abraxxa-home left 20:32 jpn joined 20:36 jpn left 20:37 jpn joined 21:04 manu_ joined, manu_ is now known as eseyman 21:12 jpn left 21:22 jpn joined 21:32 Aedil left 22:04 tobs left 22:05 tobs joined 22:08 human-blip left 22:11 human-blip joined 22:12 jpn left
wayland m: 3 + 2 :{ 4 + 5 } 22:33
camelia ===SORRY!=== Error while compiling <tmp>
You can't adverb :{ 4 + 5 }
at <tmp>:1
------> 3 + 2 :{ 4 + 5 }<HERE><EOL>
wayland m: 3 + 2 :asdf 22:39
camelia Cannot resolve caller infix:<+>(Int:D, Int:D, :asdf); none of these signatures matches:
( --> 0)
($x)
(\a, \b)
(Real $a, Real $b)
(Int:D $a, Int:D $b --> Int:D)
(int $a, int $b --> int)
(uint $a, uint $b --> u…
wayland I was hoping to be able to adverb a block, and pass it into the operator as a third parameter. 22:40
m: 3 + 2 :s{ 4 + 5 } 22:44
camelia Cannot resolve caller infix:<+>(Int:D, Int:D, :s(Block)); none of these signatures matches:
( --> 0)
($x)
(\a, \b)
(Real $a, Real $b)
(Int:D $a, Int:D $b --> Int:D)
(int $a, int $b --> int)
(uint $a, uint $b -…
wayland Hmm. Might be able to use less slang than I thought for the block operators. Like, it's not amazing, but it could work.
22:47 Sgeo joined 22:56 wayland left 22:57 jpn joined 23:01 jpn left
grondilu timo: really cool. It's not pushed yet though, is it? 23:06