🦋 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 reportable6 left 00:05 Xliff left, reportable6 joined 01:05 coverable6 left, reportable6 left, notable6 left, evalable6 left, linkable6 left, sourceable6 left, tellable6 left, benchable6 left, squashable6 left, quotable6 left, unicodable6 left, bloatable6 left, statisfiable6 left, shareable6 left, committable6 left, releasable6 left, nativecallable6 left, bisectable6 left, greppable6 left 01:06 coverable6 joined, shareable6 joined, reportable6 joined 01:07 nativecallable6 joined 01:08 tellable6 joined, greppable6 joined 01:32 frost joined 01:43 gabiruh left, gabiruh joined 01:49 gordonfish- is now known as gordonfish 02:01 nine left, nine joined 02:06 releasable6 joined, bisectable6 joined, sourceable6 joined, statisfiable6 joined 02:07 evalable6 joined, unicodable6 joined, committable6 joined, benchable6 joined 02:08 linkable6 joined 03:06 bloatable6 joined 03:07 notable6 joined 03:08 quotable6 joined 03:33 jess left 04:06 bdju left, Altreus left, perryprog left, Ekho left, greyrat left, [Coke] left, tobs left, [Coke] joined, tobs joined, squashable6 joined 04:07 perryprog joined, greyrat joined, Altreus joined 04:11 bdju joined 04:15 Ekho joined 04:19 xkr47 left, demostanis[m] left, happy-dude left, mtj left, ugexe left, dpk left, samebchase left, tib left, samcv left, mykhal left, corwin left, eof left, xkr47_ joined, tib_ joined, [dpk] joined, tib_ is now known as tib, summerisle joined, samebchase joined, ugexe joined, xkr47_ is now known as xkr47, mplsCorwin joined, mtj joined 04:20 mplsCorwin left, mplsCorwin joined, samcv joined 04:22 amenonsen joined 04:27 mplsCorwin is now known as corwin 04:30 demostanis[m] joined 04:32 happy-dude joined 05:03 [dpk] is now known as dpk 05:54 abraxxa joined 06:00 abraxxa left 06:01 abraxxa joined 06:02 reportable6 left 06:05 reportable6 joined 06:41 abraxxa left, abraxxa joined 06:42 jjido joined 07:18 Sgeo left 07:31 lichtkind joined 07:46 dakkar joined 08:20 squashable6 left 08:22 squashable6 joined 08:28 jjido left 08:45 squashable6 left 09:48 squashable6 joined
Anton Antonov Yesterday I was experimenting with regex extractions from a large set 09:48
of files. I found that using a regex with 3 captions is ~20 slower
than using a version of it with only 1 caption. Is this expected
and/or documented somewhere? E.g. `XMLSearch0` is ~20 times slower than
`XMLSearch1`:
```
my regex XMLSearch0 {
<header>=('<FactData>')
$<data>=(<-[<>]>*)
<ender>=('</FactData>')
}
my regex XMLSearch1 {
moritz_ well, captures do require the regex engine to keep more data around, and there's an overhead to extracting it. I don't know if 20% is reasonable, but it cannot be zero cost 09:53
Anton Antonov @mortiz_ It is not 20% slower, it is 20 times slower. 09:54
Geth raku-mode: fd286b2d1a | (Philip Kaludercic)++ | 2 files
Remove pkg-info dependency
10:00
raku-mode: 20610a83b5 | (Tom Browder)++ (committed using GitHub Web editor) | 2 files
Merge pull request #53 from phikal/master

Remove pkg-info dependency
grondilu raku: class A {}; class B is A {}; say B.bless: A.new 10:32
evalable6 (exit code 1) Too many positionals passed; expected 1 argument but got 2
in block <unit> at /tmp/Y1_TWp4g_f line 1
grondilu I think that used to work
long time ago though
lizmat grondilu: what should that do ? 10:33
bless only takes named parameters 10:34
grondilu couldn't it take an instance too?
and bless it to a Class 10:35
I vaguely recall a similar mechanism in P5
lizmat why not do B.new ?
grondilu well that does not work 10:36
I want to build a new B instance from a A one
lizmat m: class A {}; class B is A {}; say B.new
camelia B.new
dakkar grondilu: in general, "build a subclass instance from a superclass instance" is not a well-defined thing to do 10:37
grondilu Oh I guess I should use a role for B instead 10:38
dakkar probably
lizmat and then use but: docs.raku.org/routine/but 10:39
grondilu yeah that seems sensible
dakkar (if you're coming from perl5, and thinking of the "re-blessing" practice… raku doesn't do that, because it's nasty and there's better ways now)
(and I have perl5 production code that reblesses happily) 10:40
10:48 evalable6 left, linkable6 left 10:49 linkable6 joined
lizmat notable6: weekly 10:51
notable6 lizmat, No notes for “weekly”
grondilu lol I'm digging into some old code and I'm reminded that there used to be a standard module called "MONKEY_TYPING" 10:52
lizmat it's now built in :-) 10:53
grondilu it was to augmont core classes, right? 10:54
*augment
lizmat docs.raku.org/language/pragmas#ind...EY__pragma 10:55
docs.raku.org/syntax/augment
10:56 sena_kun joined
grondilu again I'm pretty sure I should use roles instead 10:56
lizmat yeah, augment is *really* a last resort
as it messes with all sorts of things, and breaks optimizations 10:57
grondilu I think I wrote this code before I knew about roles, or before they were supported
lizmat yeah, that's quite possible
grondilu checks latest commit date 10:58
"30 May 2012"
might as well say prehistory 10:59
this code will need lots of rewriting 11:00
lizmat yeah, pre GLR code might need some close inspection 11:08
grondilu can you remind me what GLR is? Google did not help much. 11:10
Great List Refactor 11:11
I've just recalled 11:12
Altreus clickbait when? 11:16
:)
grondilu on the other hand my Digest library is fairly old too but seems to be running fine : github.com/grondilu/libdigest-perl6 11:18
still I bet I could modernize it though 11:19
like all these .AT-POS calls, are they still needed for better performance? 11:22
lizmat no, they're not 11:23
these will pretty quickly be optimized away
once a process runs for a bit
compare: 11:27
m: my @a = ^1000; for ^10000 { @a[$_] for ^1000 }; say now - INIT now 11:28
camelia 0.375355557
lizmat m: my @a = ^1000; for ^10000 { @a.AT-POS(0) for ^1000 }; say now - INIT now
camelia 0.238405566
lizmat huh?
m: my @a = ^1000; for ^10000 { @a[$_] for ^1000 }; say now - INIT now
camelia 0.375450081
lizmat m: my @a = ^1000; for ^10000 { @a.AT-POS(0) for ^1000 }; say now - INIT now
camelia 0.240822734
lizmat intriguing, I don't see a difference on my MacOS box
m: my @a = ^1000; for ^10000 { @a.AT-POS($_) for ^1000 }; say now - INIT now # fuh 11:29
camelia 0.346554665
lizmat *duh
m: my @a = ^1000; for ^10000 { @a[$_] for ^1000 }; say now - INIT now 11:30
camelia 0.365621664
lizmat m: my @a = ^1000; for ^10000 { @a.AT-POS($_) for ^1000 }; say now - INIT now # fuh
camelia 0.336668571
lizmat m: my int @a = ^1000; for ^10000 { @a[$_] for ^1000 }; say now - INIT now
camelia 0.398720313
lizmat m: my int @a = ^1000; for ^10000 { @a.AT-POS($_) for ^1000 }; say now - INIT now
camelia 0.454114283
lizmat m: my int @a = ^1000; for ^10000 { @a.AT-POS($_) for ^1000 }; say now - INIT now
camelia 0.449291634
lizmat m: my int @a = ^1000; for ^10000 { @a[$_] for ^1000 }; say now - INIT now
camelia 0.376347564
lizmat grondilu: I'd say, stick with postcircumfix [] :-) 11:31
and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2021/09/13/2021-37-receding/ 11:34
Altreus there it is! 11:36
lizmat yup :-) 11:40
Altreus I like Flavio's blogs
polettix: I like your blogs :D 11:41
The point about "all but the last one" for a slurpy argument is interesting - it immediately makes me think of prolog 11:46
Is raku introspective enough to even have this ability?
lizmat: your first twitter item has the wrong link :) 11:50
moritz_ counting lists from the end is a bad idea if you have lazy lists
Altreus ah yes lazy 11:55
can we have "isn't"?
sub x (List isn't lazy \x)
11:56 linkable6 left 11:58 linkable6 joined 12:04 reportable6 left 12:23 keutoi joined
guifa lizmat++ (you've been pushing these out much earlier these days haha I used to have to wait until the end of work to read them!) 12:55
grondilu degenerate cases are so annoying. Like if I want to turn an integer into a blob8, I can usually write blob8.new: $n.polymod(256 xx *), but that doesn't work for $n == 0 12:58
raku: say blob8.new: 0.polymod(256 xx *) 12:59
m: say blob8.new: 0.polymod(256 xx *) 13:00
camelia Blob[uint8]:0x<>
grondilu Am I supposed to not use polymod for this?
13:07 reportable6 joined 13:10 avar left 13:14 avar joined
Altreus lizmat: also your first list item of Core Developments appears to have a font colour override 13:34
Util grondilu: polymod is what I would use. I had not thought about that degenerate case; I would use `|| 0` to solve it, but I agree that it is annoying to have to remember to do so. 13:41
m: for 258,42,0 { say Blob.new( .polymod(256 xx *) || 0) } 13:42
camelia Blob:0x<02 01>
Blob:0x<2A>
Blob:0x<00>
Util Now that I think about it, `0.polymod($any_positive_integer)` should return `0`, not the empty list, IMHO.
Maybe this is a bug.
Roast does not test it: github.com/Raku/roast/blob/master/.../polymod.t 13:44
Altreus is there a bot to show docs? 13:46
or, reframed: I'm too lazy to open a new browser tab when I'm already in IRC
when you give polymod a list n xx *, what is the *? 13:53
grondilu Util: I don't think this is a bug. As written in the doc : "The last non-zero value will be the last remainder." 13:55
so if the first value is zero, then you get nothing.
Altreus the "implementation" in the doc also implies that, because it's described in terms of a for loop 13:56
eh, no, wait
the implementation implies you get something because it should iterate over your integer 13:57
m: say 0 mod 10
camelia 0
grondilu though it's a bit confusing, since polymod doesn't only give remainders, but also quotients
Altreus in fact the docs show that if you keep giving it a bunch of things that mod to 0 you still get them: say 120.polymod: 1, 10, 10², 10³, 10⁴; # OUTPUT: «(0 0 12 0 0 0)␤» 13:58
so 0.polymod(list) should give you n+1 zeroes
"The number of remainders will be always one more item than the number of given divisors"
zero shouldn't have any special behaviour at all, as far as I can see
grondilu yes but : "If the divisors are given as a lazy list, runs until the remainder is 0 or the list of divisors is exhausted." 13:59
Altreus ah
but do you get at least one 0?
grondilu nope
Altreus m: say 10.polymod(10 xx *)
camelia (0 1)
Altreus oh
grondilu m: say blob8.new: 0.polymod(256 xx *) 14:00
camelia Blob[uint8]:0x<>
Altreus that's not how maths works
:D
m: say 10.polymod(1 xx *)
camelia (0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...)
Altreus !
I've been lied to
grondilu that's not right
or rather, LTA 14:01
also arguably that's a degenerate case too 14:02
Altreus hrm
grondilu .../src/core.c/Real.pm6#L74 14:07
"last if $lazy and not $more;"
when divisor is 1, $more is constant 14:08
Altreus right, div 1 - makes sense 14:10
Except that's not how you check that the remainder is not 0 ;)
I guess it has to be a lazy list *entirely* of 1s 14:11
grondilu I don't think so
Altreus I mean if it's not then it'll end due to the list, so it's a very edge case 14:12
grondilu 1 cannot be a remainder in this case
an infinite list of zeros actually makes some sense 14:13
14:14 justsomeguy joined
grondilu it is, however, very much a degenerate case, and maybe the function should fail instoad 14:14
Altreus except that the doc says it should stop
I'll pop an issue in and see what people think
grondilu I think the issue is with the doc, not the function.
Altreus this will give people the option to decide which :) 14:15
14:15 Sgeo joined
grondilu fair point 14:15
14:19 leont left, leont joined
Altreus github.com/rakudo/rakudo/issues/4523 :) 14:20
lizmat: perhaps the weekly could also highlight GH issues that turn into discussions? Unless it already does and I've not remembered :) 14:24
moritz_ Altreus: if you notice an issue turning into a weekly-worthy discussion, just write "weekly: " and then the URL to the issue in here. There's a bot that collects those links 14:26
14:26 rjbs left 14:27 rjbs joined
grondilu I think ideally polymod should be written with &infix:mod and some clever FP tricks. Not necesserarily in the core, but as part of the documentation, to clarify what polymod does. 14:34
so that we can better assess what the degenerate cases should be. 14:35
dakkar github.com/rakudo/rakudo/blob/b14d...#L119-L149 it's definitely written using `mod` 14:36
Util Altreus: `256 xx *` is an infinite list of 256, 256, 256.... (Answering the q from 45 minutes ago) 14:38
grondilu Isn't there a way to write it with reduce and zip or something? 14:39
dakkar maybe? /me tries 14:40
Geth raku-mode: 095b8666e3 | (Tom Browder)++ (committed using GitHub Web editor) | CHANGELOG.md
Bump version for PR #59
raku-mode: 155b0b7a4a | (Tom Browder)++ (committed using GitHub Web editor) | CHANGELOG.md
Update CHANGELOG.md
14:41
raku-mode: ef229addc0 | (Tom Browder)++ (committed using GitHub Web editor) | CHANGELOG.md
Update CHANGELOG.md
14:42
raku-mode: eaac071f17 | (Tom Browder)++ (committed using GitHub Web editor) | CHANGELOG.md
Correct PR merge date
14:46
14:53 frost left
Altreus Util: that's what I thought, but the docs say it can't be infinite! 14:56
grondilu: the docs *do* show it in terms of mod and div= 14:57
from which one would expect 0.polymod(anything) would return a single 0
14:58 justsomeguy left
Util grondilu, dakkar: This is the closest I got to zip/reduce. AFK now. 14:58
m: say 3 + 5* 256 + 7*256*256;
camelia 460035
Util m: sub pm ($acc is copy) {return (256 xx *).produce({ sink $^a; my $x = $acc mod $^b; $acc div= $^b; last if !$x; $x; }).skip.head(12); }; say pm(460035);
camelia (3 5 7) 14:59
dakkar the gather/for/take way is clearer to me
(especially the way it's written for Real; the Int one is essentially the same but split in lazy/not-lazy maybe for performance reasons) 15:00
Altreus the gather/take for Int also fails to stop at the documented time 15:04
dakkar the docs are wrong ☺ 15:05
Altreus well it should be documented that they're wrong ;)
dakkar (roast says so: `is 86400.polymod(60), (0,1440)`
Altreus I meant that a lazy list should stop when the mod is zero 15:07
dakkar yes, sorry, wrong line 15:08
github.com/Raku/roast/blob/master/...ymod.t#L11
Altreus oh but wait that means the doc was right 15:09
which means the infinite-ones behaviour is wrong :)
I note that zero is not part of that list
the output I mean
dakkar sure is, it's the first element 15:10
Altreus ah it's the first part, not the last
dakkar 123456780 mod 10 == 0
15:10 linkable6 left
Altreus hmm 15:11
my brain is failing to grasp at a point related to this "base conversion" example in the docs 15:12
But it's along the lines of, if you can use polymod to do a base conversion it stands to reason it should be able to return multiple zeroes in a row 15:13
yes
m: say 65.polymod(2 xx *)
camelia (1 0 0 0 0 0 1)
dakkar yes 15:14
Altreus ^ polymod cannot possibly stop when it gets a zero in a lazy list
I'll add it to my issue
oh it has been noted
dakkar and I've added the link to roast 15:15
re: infinite list of 1s, the current behavious looks good to me
(base-1 is a degenerate case and should not be catered to) 15:16
otoh, `0.polymod(@anything)` should probably return `(0,)` instead of `()`… 15:17
Altreus yes, with an example of returning multiple zeroes in a row it's clear the docs are misworded
my maths brain doesn't come up with such conclusions as quickly as people more knee-deep in the knowledge!
dakkar that's why there's more than one person building this whole thing 😁
Altreus oh I thought it was entirely jnthn 15:34
16:09 keutoi left 16:11 linkable6 joined 16:40 dakkar left 17:21 melezhik joined
melezhik . 17:21
Altreus . 17:26
17:27 sena_kun left 17:49 pjlsergeant left, pjlsergeant joined 18:02 reportable6 left 18:04 zostay left 18:05 zostay joined 18:09 Maylay left 18:13 perlbot left, simcop2387 left 18:16 xinming joined 18:26 Maylay joined, kjp left 18:28 kjp joined
melezhik when I upload my module to zef should I remove (eventually) it from PAUSE index? 18:34
I have 2 Sparky listed now on rakuland - raku.land/?q=Sparky which is confusing ...
18:44 Maylay left 18:51 evalable6 joined 18:54 Maylay joined
tonyo melezhik: if you'd like to. there's been a lot of discussion on how to de-dupe (or whether to) in #raku-land 18:55
it seems like it shouldn't be on the consumer side to dedupe but up to the author on how they're presented because they are _technically_ different dists
19:00 Maylay left 19:02 Maylay joined 19:05 reportable6 joined 19:13 kawaii_ left, kawaii_ joined
El_Che you "technically" won :) 19:16
tonyo technically is the best kind of ally 19:17
El_Che it's like winning a boxing match by points
just playing with words here, technically not making a point 19:18
19:56 perlbot joined 19:59 simcop2387 joined 20:03 squashable6 left 21:03 reportable6 left, statisfiable6 left, linkable6 left, sourceable6 left, committable6 left, evalable6 left, bisectable6 left, nativecallable6 left, unicodable6 left, benchable6 left, shareable6 left, greppable6 left, notable6 left, quotable6 left, bloatable6 left, releasable6 left, tellable6 left, coverable6 left, releasable6 joined
melezhik tonyo , i see, thanks. i will probably remove my old versions from pause then ... 21:03
21:04 sourceable6 joined, linkable6 joined, benchable6 joined, coverable6 joined 21:05 squashable6 joined, quotable6 joined 21:06 evalable6 joined, nativecallable6 joined 21:14 melezhik left 22:03 unicodable6 joined 22:04 tellable6 joined 22:05 greppable6 joined, notable6 joined 22:06 shareable6 joined, bloatable6 joined 22:11 Xliff joined
Xliff Is there a MetaModel call that can find a method candidate if given a capture? 22:12
Ah! Cando
22:42 squashable6 left 22:44 squashable6 joined 22:47 sftp_ joined 22:48 sftp left, sftp_ is now known as sftp 23:04 bisectable6 joined 23:05 committable6 joined, statisfiable6 joined 23:28 monkey_ joined 23:40 monkey_ left