🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
00:02 djerius left, djerius_ joined, reportable6 left
MasterDuke Summer: github.com/rakudo/rakudo/issues/4662 00:05
Nemokosch <:cameliathink:897316667653247057> 00:09
00:42 tom joined 00:43 tom left 01:04 reportable6 joined
SmokeMachine m: say none(1,2,6) == 6 02:00
camelia none(False, False, True)
02:04 evalable6 left, linkable6 left 02:06 linkable6 joined 02:07 evalable6 joined
Summer @MasterDuke, thank you muchly, also might be worth swapping in a permalink: github.com/Summertime/answers/blob...02/raku-pm 02:08
03:07 evalable6 left, linkable6 left 03:18 solitario left
merryprog Since we were talking(ish) about emojis(ish) the other day(ish), here's something tangentially(ish) related: javier.xyz/emoji-to-scale/ (news.ycombinator.com/item?id=29425735) 03:45
04:07 evalable6 joined 04:09 linkable6 joined 04:27 Sgeo joined 05:17 Sgeo_ joined 05:20 Sgeo left
pie_flavor wow, I just found the mother of all Comma bugs 05:48
if you write a specific bit of code, you stop being able to type things, even though you can still e.g. copy/paste
where do I report these? doesn't seem to be a github linked from the website 05:50
06:02 reportable6 left
japhb pie_flavor: The Comma folks overlap with the #cro folks, you can probably ask for a bug submission link there. 06:17
(Though they are out of timezone right now)
pie_flavor ah, that doesn't have a discord bridge 06:21
elcaro Not having a .zip (or .tranpose) method on Iterables seems like a missed opertunity. would make transformation pipelines easier 06:38
will monkey patch it in a module for the time being
pie_flavor Does Raku have a function that sorts a single element of a list in O(n), i.e. so that all larger numbers are after it and all smaller numbers are before it? 06:56
Rust calls this function `select_nth_unstable` but used to call it `partition_at_index`.
06:58 Nicholas left
elcaro No 07:25
07:29 seednode left 07:30 seednode joined
pie_flavor sad. what is the shortest way to convert nil to a default value, but not also convert 0 (so not ||)? 07:52
moon-child / 07:56
err
//
m: say Nil // ';o'; say 0 // ';o'
camelia ;o
0
07:56 eseyman joined 07:59 abraxxa joined 08:03 abraxxa left 08:04 abraxxa-home joined, abraxxa joined 08:05 reportable6 joined 08:11 Woodi left 08:12 Woodi joined 08:23 TheAthlete joined 08:45 discord-raku-bot left 08:46 discord-raku-bot joined, abraxxa-home left 08:47 abraxxa-home joined 08:51 riffraff joined 09:04 xinming left 09:05 xinming joined 09:16 Ergo444 joined
Ergo444 hi all 09:16
09:19 xinming left, Sgeo_ left
Nemokosch hellu 09:21
09:21 xinming joined, archenoth joined 09:22 Oshawott left 09:26 Skarsnik joined 10:00 riffraff left 10:10 pony joined 11:10 evalable6 left, linkable6 left 11:27 xinming left 11:40 Altai-man joined 11:48 Skarsnik left
tbrowder ugexe: you here? 11:48
on my local host all is well with zef, fez, and App::Mi6 (2.0.1) 11:50
on a remote server, zef and fez ok, latest raku, zef info shows App::Mi6 ver 2+ 11:51
zef install only installs App::Mi6 1.*, not 2*, weird 11:52
should i blow away zef's undercarriage db?
.tell ugexe ^^^ 11:53
tellable6 tbrowder, I'll pass your message to ugexe
lizmat tbrowder: on my machine, a "zef upgrade App::Mi6" did the right thing 11:59
tbrowder duh, i’ll try requesting the desired ver (but still, what gives?)
lizmat: thnx, that wrkd on local host, my remote is prblm 12:00
12:02 reportable6 left, patrickb joined 12:11 evalable6 joined 12:13 discord-raku-bot left, discord-raku-bot joined
tbrowder well, on the remote, upgrade would NOT work, but specifying the version suceeded 12:15
think something is messed up with zef db there... 12:16
i think with the first no upgrade i should have run plain "zef upgrade" to see if updating pkg indices would have helped. anyway, i just uninstalled mi6, then requested it be installed and got latest version, so no apparent foul. 12:22
lizmat: silently looks cool. would it solve the testing problem you think instead 12:23
**when testing "shell cmd" and trying to capture its output? 12:25
lizmat silently just overrides $*OUT and $*ERR for the scope of the block given 12:26
I don't think shell output makes it to $*OUT or $*ERR ?
ugexe it will if you don't specific :out or :err 12:27
tellable6 2021-12-03T11:53:33Z #raku <tbrowder> ugexe ^^^
lizmat in that case it will :-) 12:28
tbrowder ugexe: you see my recent experience with zef above? 12:31
"zef info" reported latest mi6 but wouldn't upgrade it without me requesting specific version 12:33
ugexe what zef version?
oh latest? hmm 12:34
tbrowder just an anomaly with pkg indexes outdated or something similar? 0.13,0
ugexe ah thats not the latest
12:35 sienet_ja_LSD[m] joined
ugexe in 0.13.1 i took priority away from the cache 12:36
12:36 Ergo44471 joined
tbrowder hm, i tried to "zef upgrade zef" but that didn't work. i guess i have to reinstall from src 12:36
Ergo44471 hi 12:37
tbrowder howdy
Ergo44471 when I install the module Hash::File
tbrowder or "zef install 'zef:ver<0.13.1>'" 12:38
12:39 abraxxa left
ugexe tbrowder: zef itself might be falling victim to that bug (i.e. the cache, with its older version, is getting chosen) 12:39
Ergo44471 when i installed, it still tries to install old source 12:40
12:42 abraxxa joined
ugexe Ergo44471: what does `zef --version` say 12:42
Ergo44471 v0.13.0 12:51
12:51 riffraff joined
ugexe need to install a newer zef: `zef install github.com/ugexe/zef.git` 12:53
tbrowder ok, i just upgraded all my deb hosts to 0.13.4, 12:54
ugexe you want at least v0.13.1
12:55 riffraff left
ugexe or really anything other than v0.13.0 12:55
tbrowder this seemed to work: zef install "zef:ver<0.13.4{
12:55 riffraff joined
tbrowder *>" 12:55
12:58 riffraff left, riffraff joined 13:00 riffraff left, riffraff joined 13:04 riffraff left
tbrowder lizmat: zef upgrade to 0.13.4 sounds like a good raku weekly item to me 13:09
i hope that will also solve the problem with local module upgrades vs repo module upgrades 13:12
Ergo44471 Unsure of how to handle the following distributions: zef:ver<0.13.4>:auth<github:ugexe>:api<0>
All requested distributions are already at their latest versions
zef upgrade zef
13:13 linkable6 joined, riffraff joined
ugexe did you try the command i posted? 13:13
Ergo444 Can't upgrade identities that aren't installed: to, 0.13.4 13:14
zef upgrade to 0.13.4?
ugexe i never said to do that
well, rather just do ugexe>need to install a newer zef: `zef install github.com/ugexe/zef.git` 13:15
the command `zef upgrade to 0.13.4` isnt an actual command
Ergo444 yes
ugexe zef install github.com/ugexe/zef.git 13:17
Ergo444 ok, now something happend
ugexe run that^ dont change anything even if you think you should
sienet_ja_LSD[m] m: my $a = '101010101010'; my @b = $a.split(""); say @b.elems;
camelia 14
sienet_ja_LSD[m] why does splitting a 12 char string give you a 14 element array? 13:18
tbrowder i think the two "" on each end contribute 13:19
Ergo444 ok that is ok now
How do make zef refresh?
lizmat zef upgrade zef 13:20
sienet_ja_LSD[m] m: my $a = '101010101010'; my @b = $a.split(""); say @b;
camelia [ 1 0 1 0 1 0 1 0 1 0 1 0 ]
lizmat did the trick for me
ugexe they have already upgraded
Ergo444 I mean the modules I have kust updated
lizmat zef upgrade
sienet_ja_LSD[m] that's still a 12 element array? 13:21
lizmat sienet_ja_LSD[m]: yes, because split "" *splits*
and it splits on char boundary, and there's char boundary at beginning and end as well
Ergo444 It is not updated
lizmat what you probably want:
Ergo444 the module is not updated still
sienet_ja_LSD[m] m: my $a = '101010101010'; my @b = $a.split(""); say @b[13];
camelia
13:22 riffraff left
lizmat m: my $a = "01010101010"; my @b = $a.comb; say @b 13:22
camelia [0 1 0 1 0 1 0 1 0 1 0]
13:22 riffraff joined
lizmat sienet_ja_LSD[m] ^^ 13:22
sienet_ja_LSD[m] lizmat: ok thanks
Ergo444 funny how many stuff does not show up module search 13:23
It did not show me some modules
m: say "o
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in double quotes; couldn't find final '"' (corresponding starter was at line 1)
at <tmp>:1
------> 3say "o7⏏5<EOL>
expecting any of:
argument list
…
Ergo444 m: say "o"*45
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5o' (indicated by ⏏)
in block <unit> at <tmp> line 1
Ergo444 m: say "o" x 45
camelia ooooooooooooooooooooooooooooooooooooooooooooo
Ergo444 m: say 45 x "o" 13:24
camelia WARNING: unhandled Failure detected in DESTROY. If you meant to ignore it, you can mark it as handled by calling .Bool, .so, .not, or .defined methods. The Failure was:
Cannot convert string to number: base-10 number must begin with valid digits or …
13:27 riffraff left, riffraff joined 13:30 abraxxa left 13:32 riffraff left 13:34 riffraff joined 13:35 riffraff left, riffraff joined
Ergo44471 is there a way to measure the speed of a code section? 13:39
lizmat m: for ^1000 { my $a = $_ * $_ }; say now - LEAVE now 13:43
camelia Potential difficulties:
Useless use of 'now' in sink context
at <tmp>:1
------> 3{ my $a = $_ * $_ }; say now - LEAVE now7⏏5<EOL>
Instant:1638539030.392395133
Use of Nil in numeric context
in block <unit> at <tmp> line …
lizmat m: for ^1000 { my $a = $_ * $_ }; LEAVE say now - ENTER now
camelia 0.001780406
lizmat m: for ^100000 { my $a = $_ * $_ }; LEAVE say now - ENTER now 13:44
camelia 0.027159605
Ergo44471 phasers 13:47
funny that you can use phasers in expressions
13:48 frost left
lizmat yeah, that's pretty cool 13:51
Ergo44471 when is thaf expression evaluated? 13:52
lizmat the "ENTER now" is evaluated when entering the scope and "freezes" its return value 13:54
the "LEAVE say now - ..." is evaluated when the scope is left 13:55
13:59 A26F64 joined
sienet_ja_LSD[m] m: my Bool $a = True; my Int $b = $a ? 1 : 0; say $b; 14:01
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of ? and : for the ternary conditional operator. In
Raku please use: ?? and !!.
at <tmp>:1
------> 3my Bool $a = True; my Int $b = $a ?7⏏5 1 : 0; say $b;
sienet_ja_LSD[m] m: my Bool $a = True; my Int $b = $a ?? 1 : 0; say $b; 14:02
camelia 5===SORRY!5=== Error while compiling <tmp>
Please use !! rather than :
at <tmp>:1
------> 3my Bool $a = True; my Int $b = $a ?? 1 :7⏏5 0; say $b;
expecting any of:
colon pair
sienet_ja_LSD[m] m: my Bool $a = True; my Int $b = $a ? 1 :: 0; say $b;
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of ? and : for the ternary conditional operator. In
Raku please use: ?? and !!.
at <tmp>:1
------> 3my Bool $a = True; my Int $b = $a ?7⏏5 1 :: 0; say $b;
sienet_ja_LSD[m] m: my Bool $a = True; my Int $b = $a ?? 1 :: 0; say $b;
camelia 5===SORRY!5=== Error while compiling <tmp>
Please use !! rather than ::
at <tmp>:1
------> 3my Bool $a = True; my Int $b = $a ?? 1 :7⏏5: 0; say $b;
expecting any of:
colon pair
14:03 reportable6 joined 14:07 riffraff18 joined 14:11 riffraff left
SmokeMachine I think I've already suggested that, but: twitter.com/smokemachine/status/14...67873?s=20 14:51
14:52 monkey_ joined
SmokeMachine I really think that would be an improvement to .reduce to receive a "first aggregation value" as an optional positional parameter 14:52
patrickb o/ 15:20
(Moving discussion here...) I'm working on a small side project where I try to embedd a rakudo (basically a mod_rakudo apache plugin).
At the core I need to call a raku function from C. I a clean way to do that is to set up a callback function via nativecall in raku land and then use that callback on the C side. 15:23
*I think that
Now apache being apache has each request in it's own thread. Is there any documentation on the limits wrt treads and nativecall callbacks? Can I just concurrently hit the same callback from different threads? 15:25
I.e. share a single VM instance?
Or should I better give each thread its own interpreter? 15:26
15:29 monkey_ left
sienet_ja_LSD[m] how to fix expected Positional[Array] but got Array ([ ...) 15:32
just passing an array to a sub as an argument 15:33
Altai-man sienet_ja_LSD[m], either remove the constraint or ensure type on the caller side 15:40
e.g.
m: sub a(@a) { say @a }; a([42]);
camelia [42]
Altai-man ^ removing the constraint 15:41
m: sub a(Int @a) { say @a }; a([42]);
camelia Type check failed in binding to parameter '@a'; expected Positional[Int] but got Array ([42])
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
Altai-man ^ this throws
m: sub a(Int @a) { say @a }; a(Array[Int].new(42));
camelia [42]
sienet_ja_LSD[m] ah ok thanks
Altai-man ^ this ensures the constraint is sensible from the caller side
m: Array[Int].new(42, "Str")
camelia Type check failed in assignment to ; expected Int but got Str ("Str")
in block <unit> at <tmp> line 1
Altai-man in general it's because unless you specify the type it won't check what's inside the array and then the subroutine doesn't want to "risk" and accept something potentially bogus 15:42
sienet_ja_LSD[m] well the type was Array
Altai-man you mean like "sub foo(Array @foo) {}"? 15:43
sienet_ja_LSD[m] yes 15:44
15:44 Sgeo joined
Altai-man "@" sigil implies @rray by itself (or rather anything doing Positional role), so "typing" the variable with this sigil specifies type of elements inside the Positional. So "Int @rray" is a positional of Ints and "Array @rray" is a positional of Arrays. 15:45
so you can either drop the type if you don't want it, "@" will imply something positional for you, or do "Array $foo" if you want it for some reason. 15:46
15:46 monkey_ joined
sienet_ja_LSD[m] sub foo(Str @data) gave me an error Type check failed in binding to parameter '@data'; expected Positional[Str] but got Array (...) 15:47
but it works if you just remove the type 15:48
Altai-man yup, same case. if you don't want a type guarantee, then remove the type declaration, otherwise ensure types on the caller side. 15:49
sienet_ja_LSD[m] aye 15:51
15:54 riffraff18 left, riffraff18 joined 16:10 gfldex left, discord-raku-bot left 16:13 riffraff18 left, riffraff18 joined 16:27 monkey_ left 16:29 mmat joined 16:40 xenu joined
xenu hi, how common is it to use .pl and .pm extensions for raku? i'm asking because i wonder if it's feasible to remove those extensions from raku definition in linguist to reduce the number of false positives 16:41
i looked at the code of some random modules and none are using those extensions
.t also conflicts with perl, but it seems it *is* commonly used so it probably has to stay 16:42
lizmat I'd say that .pl and .pm can pretty much be removed at the moment... the .t question is a bit more involved :-) 16:43
16:53 riffraff18 left 16:54 riffraff18 joined 16:58 riffraff18 left 16:59 mmat left 17:17 aoeuidhtns joined 17:25 melezhik joined
melezhik does raku advent still accept papers? 17:26
Altai-man melezhik, absolutely 17:29
melezhik I have some idea in mind ... where can I get the schedule to estimate time I have ? 17:30
github.com/Raku/advent/blob/master...authors.md
?
17:35 monkey_ joined
SmokeMachine Why did the squashathons end? 17:37
17:55 abraxxa-home left
Altai-man SmokeMachine, no people with free time to push it each time. 17:55
[Coke] had a weird VMNull error show up today: gist.github.com/coke/df02b554112fc...8cc0aad88f 17:57
I do not expect .type to actually do something helpful here, but that error message is bad.
Altai-man [Coke], can you try with `--ll-exception` flag? 17:58
18:01 Altai-man left 18:02 reportable6 left
[Coke] added 18:03
I'm on moar-2021.10
If a squashathon is something you're interested in, and you'd feel more comfortable working with someone, I'd recommend asking around here on IRC to see if you can get a mini mentoring session 18:06
if you're comfortable working on your own, maybe just let folks know you're looking at a particular ticket. 18:07
18:08 melezhik left
SmokeMachine .tell Altai-man yes, that makes sense, thanks 18:18
tellable6 SmokeMachine, I'll pass your message to Altai-man
18:18 riffraff18 joined 18:22 riffraff18 left, riffraff18 joined 18:27 riffraff18 left 18:58 Ergo44471 left 19:01 monkey_ left 19:02 monkey_ joined 19:03 reportable6 joined 19:17 riffraff18 joined 19:19 riffraff18 left 19:20 riffraff18 joined 19:24 riffraff18 left 19:26 monkey_` joined 19:27 monkey_ left 19:32 dextercd joined
patrickb Is there any special trickery involved, to call a function via NativeCall, that has been defined in the executable itself (i.e. in the minimal C program I wrote, which links libmoar.so and starts the interpreter)? 19:39
As it stands now it just prints: "Cannot locate symbol 'set_callback' in native library ''"
patrickb suspects I need to set some gcc flag to make the functions available for external use... 19:41
19:41 monkey_` left 19:42 Skarsnik joined
patrickb google is my friend: stackoverflow.com/a/17083153 19:45
19:46 riffraff18 joined
lizmat patrickb: I think a bare "is native" should be enough? 19:55
e.g. github.com/lizmat/P5localtime/blob...akumod#L28
19:56 riffraff18 left
patrickb lizmat: I already solved it. As that SO post stated, I was missing a linker flag, to make the symbols available: -Wl,--export-dynamic 19:56
19:56 riffraff18 joined
patrickb lizmat: I don't want to call into a standard library, but call a function I have written myself in the same .c file, where I set up and run the moar interpreter. 19:57
lizmat Ah, ok, I see :-)
19:59 riffraff18 left, riffraff18 joined 20:00 riffraff18 left 20:01 riffraff18 joined 20:05 riffraff18 left
Skarsnik is there a place to post blog post? I tried the 'Onion perl' site like I was using a long time ago, but the markdown support is aweful x) 20:06
tellable6 2021-12-01T00:44:41Z #raku <tonyo> Skarsnik you need to name the block itself, eg: token <name> { };
lizmat Skarsnik: would it be acceptable as an advent blog post ? 20:07
20:07 riffraff18 joined
Skarsnik It's like a multi part thing of an on going work x) 20:08
I don't think it really fit the advent theme x)
lizmat ah, well... most people I know either set up their own server if they have the hardware, or they use wordpress or similar
tonyo i use github pages 20:09
works well enough with a custom domain and it's free
patrickb I'd vote for a non perl / raku platform for non echo chamber readers and best a popular one.
What about dev.to? 20:10
tonyo for the blog?
patrickb yes
tonyo another banger 20:11
patrickb banger?
tonyo a good one
patrickb ah :-)
tonyo or a sausage if you're british
patrickb learns he's not that good with figures of speech 20:12
20:14 riffraff18 left
Skarsnik I copy/paste the preview from code in the thing as rich text x) blogs.perl.org/users/sylvain_coline...day-1.html 20:14
20:14 riffraff18 joined 20:18 riffraff18 left
patrickb nine: I'm currently a bit puzzled by: github.com/niner/Inline-Perl6/blob...s#L90-L109 Can you quickly explain, what's happening / point me in a direction where to start reading? 20:18
Skarsnik Magic *pouf* 20:19
patrickb oh... This is a copy of the first few lines of MVM_interp_run 20:28
20:34 A26F64 left 20:38 riffraff18 joined
nine patrickb: it may be about time to have a real look at how embedding MoarVM should work. When I wrote that code I had pratically no experience at all with MoarVM internals. 20:39
That's why I did the thing with the native callback. It's what I knew from writing Inline::Perl5
Skarsnik yes, please, I want to use Raku from C/C++ software xD 20:40
patrickb nine: My idea was, to get that mod_rakudo apache thing going, and then write a blog post explaining how it works. 20:41
:-P
but I'm not yet at the point of having a good understanding of things. 20:42
So I'm grateful if you beat me to a writeup. That would probably be a welcome read given my current state of knowledge. 20:44
20:46 riffraff18 left 20:47 riffraff18 joined 20:51 riffraff18 left 20:53 discord-raku-bot joined 20:55 discord-raku-bot left 20:57 discord-raku-bot joined, riffraff18 joined 21:03 aoeuidhtns left, gfldex joined 21:22 TheAthlete left 21:23 riffraff18 left, riffraff18 joined
tbrowder lizmat: is yr day 4 scheduled? jj just told me he went to bed. 21:34
i see yr draft is titled day 4. jj told me to publish mine but i’m not sure he saw day 4 in yr title 21:35
.ask lizmat are you going to publish yr day 4 at midnight utc today? 21:38
tellable6 tbrowder, I'll pass your message to lizmat
tonyo patrickb: at the very base isn't it just a matter of calling a rakudo script with the request data? 21:59
or nogo on cgi?
21:59 riffraff18 left 22:00 riffraff18 joined 22:04 riffraff18 left, riffraff18 joined 22:09 riffraff18 left
patrickb tomyo: Basically yes. But then I pay the startup penalty. 22:12
But without restarts I lose the typical dynamic nature of those mod_* thingies. I.e. drop a new .rakumod file in there, press F5 in the browser and it'll just work. 22:13
tonyo do you have something running evaluators in a pool? 22:18
err, oh misread that - disregard 22:19
22:52 discord-raku-bot left
moon-child patrickb: github.com/moon-chilled/libport prior art 22:55
23:06 Skarsnik left
patrickb moon-child: Ha! Had I noticed that earlier! The prototype code I have isn't nearly as fleshed out as what you have there, but what I have is almost identical (I also took Inline::Perl6) as a starting point. 23:18
moon-child: Did you manage to make raku state transient? I. e. could a piece of code one evaluates add modules and stuff and afterwards remove all that and start fresh? 23:21
23:23 dextercd left 23:32 Ergo444 left 23:50 gordonfish- joined 23:53 gordonfish left
moon-child patrickb: sadly no. I wasn't even able to create more than one mvm state! (Though I expect this is mvm's fault, not mine) 23:54
checkpointing would be really cool, though, as a language feature 23:56
(terrible idea of the day: do it with fork)
23:56 Colt left 23:58 Colt joined