🦋 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:06 Success joined, Success left, Success joined 00:10 Aliv3 left 00:11 Aliv3 joined 00:13 Success left 00:19 Aliv3 left 00:22 Success joined 00:30 Success left 00:31 Success joined, Success left, Success joined 00:35 Black_Ribbon left 00:42 aborazmeh joined, aborazmeh left, aborazmeh joined 00:46 xinming left, xinming joined 00:54 szqdsegrhrdgdrg joined
szqdsegrhrdgdrg hi 00:55
Perl7 is out !
Python is dead
Ruby is dead
Raku is dead
Perl7 is out !
00:57 leont left 00:59 xinming left, Success left, xinming joined 01:06 lizmat left 01:19 molaf left 01:25 Doc_Holliwood left 01:27 szqdsegrhrdgdrg left
cpan-raku New module released to CPAN! Tomty (0.0.12) by 03MELEZHIK 01:28
01:29 xinming left, xinming joined 01:31 molaf joined 01:46 aborazmeh left 01:53 xinming left 01:55 xinming joined 02:03 Manifest0 left 02:05 Manifest0 joined 02:08 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg 02:15 MasterDuke left 02:45 xinming left 02:47 xinming joined 02:49 sena_kun joined 02:54 sena_kun left 02:56 sena_kun joined 03:05 sena_kun left 03:08 rir joined 03:10 rir left 03:21 xinming left, xinming joined 03:28 gnufr33dom left 03:40 Guest82400 is now known as aluaces 04:13 Success joined 04:17 Success left 04:37 BenGoldberg left 04:38 xinming left 04:39 xinming joined 04:54 skids left 05:03 jmerelo joined 05:19 Doc_Holliwood joined 05:40 bocaneri joined 05:53 maettu joined 05:55 molaf left 05:58 xinming left 05:59 xinming joined, ufobat_ joined 06:27 xinming left, xinming joined 06:45 xinming left 06:46 xinming joined 06:55 MasterDuke joined 07:11 Manifest0 left 07:12 xinming left, xinming joined 07:16 Manifest0 joined 07:28 BenGoldberg joined 07:30 xinming left, xinming joined 07:38 Sgeo left 07:47 dakkar joined 07:53 xinming left, xinming joined 07:57 frost-lab joined 08:02 BenGoldberg left 08:24 pecastro joined 08:45 qqwe joined 08:46 jmerelo left 08:47 qqwe left 08:51 maettu left, rindolf joined
El_Che szqdsegrhrdgdrg eloquence convinced me 09:07
09:11 lizmat joined 09:13 MasterDuke left 09:14 xinming left, xinming joined 09:28 MasterDuke joined, pecastro left 09:30 lizmat_ joined 09:33 lizmat left 09:39 xinming left 09:40 xinming joined 09:53 frost-lab left 09:54 frost-lab joined, lizmat_ is now known as lizmat
lizmat clickbaits rakudoweekly.blog/2020/10/12/2020-...irst-year/ 09:54
09:57 wamba joined
Altreus clicks 10:12
Damn! Baited
lizmat :-) 10:16
10:22 Doc_Holliwould joined 10:25 xinming left 10:26 Doc_Holliwood left 10:27 xinming joined 10:45 xinming left, xinming joined 10:53 BenGoldberg joined 10:55 _jrjsmrtn joined, __jrjsmrtn__ left 11:02 xelxebar left, xelxebar joined 11:09 Doc_Holliwould left, aborazmeh joined, aborazmeh left, aborazmeh joined
Altreus liz is a master ... never mind 11:12
lizmat master elipsis ? 11:13
:-) rather :-)
cpan-raku New module released to CPAN! Date::Names (2.1.1) by 03TBROWDER 11:15
tbrowder note Date::Names now has eleven languages including a second Norwegian one 11:18
Altreus a bit dotty perhaps 11:22
11:28 xinming left, xinming joined 11:29 BenGoldberg left 11:39 leont joined 11:48 Geth joined 11:52 xinming left, xinming joined 12:01 Geth_ joined 12:02 Geth left 12:07 aborazmeh left 12:08 xinming left 12:09 domidumont joined, xinming joined 12:18 maettu joined
kawaii Do subroutines have any awareness of _where_ they were called from? I.e. if my application has a frontend UI, but also an API - is there a smart way of knowing which module called my routine so that I can adjust the log output accordingly? 12:26
12:35 stux|RC left 12:37 stux|RC joined 12:40 stux|RC left, stux|RC joined
moritz kawaii: the caller() function can provide such information 12:42
though I don't know how expensive it is
might be better design to do that through some other mechanism 12:43
tadzik a dynamic $*LOGGER or something along those lines may be a bit more controllable and predictable 12:44
kawaii moritz: yes I was thinking of just setting a bool in the signature like $api and using that to determine where it came from :)
tadzik if your routine needs to be aware of its surroundings to log sensibly then it's likely doing a bit too much :)
12:44 aborazmeh joined, aborazmeh left, aborazmeh joined 12:45 frost-lab left
Geth_ ¦ problem-solving: lizmat self-assigned Aleks-Daniel Jakimenko-Aleksejev (aka AlexDaniel) is a toxic influence and should be banned from Rakudo github.com/Raku/problem-solving/issues/238 12:47
12:55 jmerelo joined
Altreus Is there a Log4Raku or something like that? 13:09
lizmat modules.raku.org/search/?q=Log 13:15
timotimo there's a logging framework that seemed pretty sophisticated but i only looked at the readme so far
[Coke] IWBNI cpan-raku gave me a URL to *something* on cpan. 13:20
timotimo agreed; what would you like? 13:25
i think cpan-raku may react faster than most places update? certainly modules.raku.org
13:26 Doc_Holliwould joined
moritz kawaii: also, if your API is a class, you could add an "origin" attribute or so 13:29
13:29 jmerelo left
[Coke] timotimo: if we can't link to the actual module, maybe to the author? 13:30
Altreus likewise, I found LogP6 which looks too complex to grasp at a glance
[Coke] if we can construct a link that *will* work, use that, even if it takes a minute for it to show up live. Most people are seeing the links in review, after all
timotimo mh 13:31
kawaii `Log::Timeline` looks good, and I'm already using Cro in my project so I think I'll investigate that option 13:32
13:34 domidumont left
timotimo it's a bit more special-cased to handle "nested" blocks that are timed, and events that are just points in time, and you can add a datastructure to them 13:34
Altreus I have a feeling that's always the case for logs but we've never noticed before 13:38
i'm interested in the concept
lizmat it's the module that powers one of the paid features of Comma :-) 13:39
timotimo it's very fun to look at
13:51 Sgeo joined 14:04 aborazmeh left 14:07 Doc_Holliwould left 14:11 ggoebel joined
[Coke] how do we look at CPAN releases of Raku modules? 14:14
is metacpan.org/author/TBROWDER/releases sufficient to also see Raku? (those look like Raku in that particular folder) 14:15
in ../COKE/... they are definitely p5, though 14:16
why do I see things in metacpan.org/author/COKE/releases that I don't see in pause.perl.org/pause/authenquery?A...lete_files ?? 14:18
(was going to delete some very old things from CPAN, but pause doesn't have them.) 14:19
14:20 BenGoldberg joined, BenGoldberg left 14:21 BenGoldberg joined 14:27 silug joined
ggoebel zef appears to use the json files here: github.com/ugexe/Perl6-ecosystems/ 14:30
which are generated by github.com/ugexe/Perl6-App--ecogen
14:37 guifa joined
guifa o/ 14:37
The libarchive module is giving me some install problems and I’m tryignt o trouble shoot it so I can submit a PR (be it documnentation or code). 14:38
I’m getting the error Cannot locate native library '(null)': dlopen(libarchive.13.dylib, 10): image not found 14:42
ggoebel what version of macos? ...colomon recently mentioned issues with dynamic libraries. let me see if I can track that down. 14:43
guifa ggoebel: I’m on 10.15.6 14:45
I think the last time I did this install I was on 10.15.[≤4] and it worked okay, but it’s been a while
ggoebel colabti.org/irclogger/irclogger_lo...10-03#l326 14:46
backlogging it now
his workaround was to copying the offending *.dylib to /usr/local/lib 14:47
guifa Ah yikes. Okay, so it’s definitely not just Libarchive
guifa tries to remember where homebrew said it had to install libarchive because, hooray, macOS doesn’t like files going in certain places 14:48
14:48 cpan-raku left 14:50 cpan-raku joined, cpan-raku left, cpan-raku joined
guifa ggoebel++ you’re a lifesaver 14:51
ggoebel your welcome. but really... colomon++ 14:52
guifa also thanks colomon__++ :-)
14:53 BenGoldberg left
colomon__ is wondering what he did 15:03
Ah, my muddling about with GTK::Simple a week ago. 15:04
guifa imgur.com/a/FPZmREG <— yay, my updater script actually worked as expected once I fixed Libarchive 15:14
15:15 MilkmanDan left 15:16 MilkmanDan joined 15:17 squashable6 left, squashable6 joined, squashable6 left, squashable6 joined 15:24 MilkmanDan left 15:25 MilkmanDan joined
guifa releases DateTime::Timezones update 15:25
15:28 pecastro joined
ggoebel guifa++ 15:29
15:31 rir joined 15:35 pecastro left 15:41 skids joined 15:47 sena_kun joined 15:49 molaf joined 15:56 m_ joined 16:06 jmerelo joined 16:08 vrurg left 16:23 Sgeo left 16:34 dakkar left 16:37 maettu left 16:40 Sgeo joined 16:44 Xliff joined
Xliff Is there a mechanism to use a portion of a CArray as another CArray? 16:45
timotimo must be CPointer 16:46
Xliff How would that work?
timotimo nativecast the array to a pointer and increment the pointer, also make sure the array is kept alive by a reference
Xliff I mean in C it would be: int i[10]; *new_i; new_i = i + 5; new_i[0] == i[4] 16:47
16:48 approaching236 joined
Xliff Or would that be i[5]... haha 16:48
timotimo &i[5] or i + 5
Xliff Yeah. Long day. 16:49
timotimo i[5] will be of type int, but you want int*
Xliff At any rate, can we simulate that with NativeCall?
timotimo yeah
Xliff Is it in the docs somewhere?
timotimo m: use NativeCall; my $a = CArray[int].new(1, 2, 3, 4, 5); my $p = nativecast(CPointer[int], $a); say $p.dereference; say ($p + 3).dereference 16:50
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
CPointer used at line 1. Did you mean 'Pointer'?
timotimo m: use NativeCall; my $a = CArray[int].new(1, 2, 3, 4, 5); my $p = nativecast(Pointer[int], $a); say $p.dereference; say ($p + 3).dereference
camelia No such method 'dereference' for invocant of type
in block <unit> at <tmp> line 1
timotimo m: use NativeCall; my $a = CArray[int].new(1, 2, 3, 4, 5); my $p = nativecast(Pointer[int], $a); say $p.deref; say ($p + 3).deref
camelia 1
No such method 'deref' for invocant of type 'Int'
in block <unit> at <tmp> line 1
timotimo that's not the one, hold on
m: use NativeCall; my $a = CArray[int].new(1, 2, 3, 4, 5); my $p = nativecast(Pointer[int], $a); say $p.deref; say ($p.add(3)).deref 16:51
camelia 1
timotimo m: use NativeCall; my $a = CArray[int].new(1, 2, 3, 4, 5); my $p = nativecast(Pointer[int], $a); say $p.deref; say ($p.add(3)).deref; $p.add(3) = 99; .say for $a[^5]
camelia 1
Cannot modify an immutable NativeCall::Types::Pointer[int] (NativeCall::Types::P...)
in block <unit> at <tmp> line 1

timotimo mhh hu? 16:52
m: use NativeCall; my $a = CArray[int].new(1, 2, 3, 4, 5); my $p = nativecast(Pointer[int], $a); say $p.deref; say ($p.add(3)).deref; $p.add(3)[0] = 99; .say for $a[^5]
camelia 1
Cannot modify an immutable Int (4)
in block <unit> at <tmp> line 1

timotimo that's not what i was expecting
Xliff Yeah. 16:56
m: use NativeCall; my $a = CArray[int].new(1, 2, 3, 4, 5); my $p = nativecast(Pointer[int], $a); say $p.deref; say ($p.add(3)).deref; $p.add(3).deref = 99; 16:57
camelia 1
Cannot modify an immutable Int (4)
in block <unit> at <tmp> line 1

timotimo i mean, you can easily-ish turn the pointer to an array and assign to the array's first slot 16:59
that's not fun to type out, of course
17:02 MilkmanDan left
jdv79 shouldn't type constrained parms win in multi over "non-constrained" or less narrowly constrained? 17:05
i'm a bit confused how named params factor in general i guess might be it 17:06
Xliff jdv79: Yes. However I've run into issues where params you'd think were more constrained lost to a more permissive variant 17:08
I have yet to get it to a golfable problem that's not tied to a Significantly Larger effort.
timotimo named parameters will only rule out candidates if they already match 17:09
jdv79 m: gist.github.com/jdv/d9b0c26ac52478...2c47bdea71 17:10
camelia 2
jdv79 i would have expected something more like 0␤1␤2␤4␤4␤
timotimo having 2 there is probably because that's the first one with nameds that fit 17:11
try switching :$a and :$a, :$b around
Xliff repl.it/@Xliff/LinearGranularTasks...#main.raku 17:13
I think this will work, for now.
timotimo Pointer.new($b + 5) <- i would suggest $b.add(5) instead 17:14
jdv79 ah, so order of declartion matters - somehow i missed that in the docs i read
timotimo and of course what you get back from $b[4] is a writable
so you could bind that to a scalar and assign to that
Xliff timotimo: That blows up in repl.it 17:15
timotimo yeah, :$a and :$a, :$b are the same specificity according to the multi dispatch rules (because nameds don't enter into it in the first step)
but i'm not exactly sure why the first doesn't get 0
Xliff timotimo: Was .add introduced later than 2020.07?
timotimo oh i think i misread that
jdv79 so why does the 0 arity one never get called? i think that's my last confusion. 17:16
timotimo Xliff: 2017-10-18 last touched that method
jdv79 tried reversing the order to no luck...
timotimo i've got to AFK for a bit
Xliff No such method 'add' for invocant of type 'NativeCall::Types::Pointer' 17:17
timotimo maybe the roast tests can be of interest here, but i haven't looked yet
Xliff So I'll use the + variant until I can find a better way.
This looks to be a usable workaround 17:18
jdv79 oh, that's not all - also why does a single named datetime param not hit the sig with datetimes and instead hits the "unconstrained" named sig...
timotimo Xliff: it should come from TypedPointer
jdv79 timotimo: thanks
17:19 MasterDuke left
Xliff timotimo: OK. This is the result... 17:19
timotimo Xliff: please check why method ^parameterize in NativeCall/Types.rakumod doesn't seem to give TypedPointer for Pointer[uint8]
m: use NativeCall; my $p = Pointer[uint8].new; say $p.^name
camelia NativeCall::Types::Pointer[uint8]
timotimo m: use NativeCall; my $p = Pointer[int8].new; say $p.^name
camelia NativeCall::Types::Pointer[int8]
timotimo m: use NativeCall; my $p = Pointer[int8].new; say $p.^roles
camelia ((NativeCall::Types::Pointer::TypedPointer[int8]))
timotimo m: use NativeCall; my $p = Pointer[uint8].new; say $p.^roles
camelia ((NativeCall::Types::Pointer::TypedPointer[uint8]))
timotimo oh, it does
m: use NativeCall; my $p = Pointer[uint8].new; say $p.add(1)
camelia NativeCall::Types::Pointer[uint8]<0x1> 17:20
Xliff Pointer.new($b.add(5)) --> "Default constructor for 'NativeCall::Types::Pointer' only takes named arguments"
timotimo you said you have 2020.07?
yeah, you don't put it into Pointer.new
it already returns a Pointer
Xliff I have fresh blead of the week.
It's repl.it that's got 2020.07
timotimo raku don't often have "copy constructors"
Xliff OK, that works! 17:21
I wonder if I can augment CArray
timotimo it's a class like any other, but not a P6opaque, so you can't add attributes 17:22
17:27 natrys joined 17:28 camelCaser joined 17:33 maettu joined 17:42 Altai-man joined 17:44 sena_kun left 17:45 BenGoldberg joined 17:55 pecastro joined 17:58 molaf left 18:00 ufobat__ joined 18:04 ufobat_ left
rir CArray, I seem to be missing a trick. Starting with the timespec/clock_get_time and following the CArray section on the same page ( docs.raku.org/language/nativecall#...nativecall ), I could not get a CArray[timespec] to work with the native function. Searching all of Github, I didn't find one example of a CArray of CStruct written. Any help out here? 18:05
18:06 pecastro left
[Coke] already submitted this for a contest, be curious if anyone had feedback on github.com/coke/matt-parkers-maths...rime-pairs to make it more "natural" for Raku. (Looking at it, I'd probably switch the MAIN to a unit sub since it's the whole file.) 18:08
18:11 patrickb joined 18:19 BenGoldberg left 18:23 bocaneri left 18:48 jmerelo left 18:52 xinming left 18:54 xinming joined 19:08 Doc_Holliwould joined, approaching236 left 19:18 abraxxa left 19:29 natrys left 19:42 kst joined 19:43 kst left, kst` left 19:44 kst joined 19:48 maettu left
AlexDaniel [Coke]: .tail instead of [*-1], destructuring for $left and $right instead of accessing $_, yes for a unit sub. check-path is recursive, how about putting gather outside your first call? 19:52
19:52 patrickb left
AlexDaniel that is, you can `take` no matter how deep you are 19:53
19:58 vrurg joined, xinming left 19:59 xinming joined
AlexDaniel [Coke]: the code seems to be doing depth-first search so it makes sense to describe it as such in the comments. Describing it this way may also give clues on how to optimize it 20:01
[Coke]: `next if @path.first($next)` is needlessly O(n) while you could've used an array with boolean markers 20:03
20:04 kensanata joined
AlexDaniel another way is to use a more generic approach – describe your edges and vertices by using objects, then you can have “already used” field in each object 20:05
20:05 molaf joined 20:07 MasterDuke joined 20:08 vrurg left
AlexDaniel [Coke]: as for optimizing it, the slowest and most obvious part is when you hit the same vertex more than once from slightly reordered initial steps. That is, if you've already found solutions (or figured out that there are no solutions) for a certain combination of remaining vertices, you're currently checking them all over again anyway 20:08
usually that's very easy to solve for tasks that just ask for the shortest path to finish (or the number of possible paths), but from the top of my head I don't know how to do that in cases when you must hit every vertex 20:09
also looking at it now you can just `take` your @path when you hit the finish without any additional logic 20:10
MasterDuke could it be something `for %paths{$last}.values (-) @path -> $next {`? 20:11
AlexDaniel that's probably still significantly slower than just checking an array of bools or checking a field of an object 20:12
I definitely wouldn't do it that way in a competition, which you can probably tell I used to enjoy back in the day :) 20:14
20:14 Xliff left
AlexDaniel doing something like that might also stress GC a bit too much, it depends. But a few ms wasted on something as simple as that can really lose you some points :) 20:15
can't help it x) the task itself reads almost like something straight from one of the competitions 20:16
another interesting part is optimizing the tree generation itself ( `($min..$max).combinations(2).grep(*.sum.is-prime)` ) 20:21
20:21 xinming left 20:22 kensanata left
AlexDaniel maybe a good idea to generate the primes first and then generate the edges starting with known primes 20:22
20:22 xinming joined 20:23 chloekek joined
MasterDuke m: (1..9).combinations(2).grep(*.sum.is-prime).elems.say; say now - INIT now 20:23
camelia 14
AlexDaniel for 1..9 yes, but for 1..9 you can probably bruteforce the whole thing too
MasterDuke m: (1..900).combinations(2).grep(*.sum.is-prime).elems.say; say now - INIT now # what's an actually useful range? 20:24
camelia 59678
AlexDaniel that being said, on a competition I would've probably written something that's relatively slow-ish, and then just feed it all possible inputs, create a lookup table, and submit the lookup table as a solution x)
2.5s is already too slow, the limit is usually 1s 20:25
20:27 approaching236 joined
MasterDuke ^^^ drops to 0.5s on my gmp branch 20:28
though it was only 1.7s locally on master 20:29
AlexDaniel MasterDuke: the gmp branch… is working? :O
that's fantastic news
MasterDuke it only fails a single spectest because 2**10000000000 doesn't die anymore 20:30
AlexDaniel that's amazing 20:31
what does it do instead?
I guess, hangs while trying too hard? :)
that test can be thrown away, 2**1000000000 behaves the same way I don't see a good reason why anything larger should be different 20:32
in fact maybe it's actually wrong to throw an exception at an arbitrary point, just adds an edge case where one doesn't have to exist 20:34
MasterDuke `my $a = 2**10000000000; say $a > 4` # outputs `True` almost instantly 20:37
20:38 wamba left
MasterDuke but the branch still needs a little cleanup. it's not using the gmp we build unless i LD_PRELOAD it, and i'm using a signal handle and setjmp+longjmp to handle abort()s from gmp, which i don't believe is threadsafe 20:39
*signal handler
20:39 chloekek left
MasterDuke but otherwise it's faster and ~500 fewer lines of code in bigintops.c 20:40
lizmat MasterDuke++ # hard work and progress!
Altai-man MasterDuke++ # very impressive! 20:41
MasterDuke 90% done. now just the remaining 90% to finish... 20:43
AlexDaniel MasterDuke: how much faster? Did you by any chance notice any difference running the spectest? 20:46
MasterDuke i don't think there's much difference in a spectest. i just did an assortment of math operations in a loop and noticed a measurable difference 20:49
AlexDaniel okay
MasterDuke stringification is dramatically faster
20:50 ufobat__ left 20:51 pecastro joined
MasterDuke `my ($a; $b; $c; $s); for 66..2_000 -> $e { $a = 23**$e; $b = 7**$e; $c = $a % $b; $c *= $c; $c += $a; $c -= $b; $s = $c.is-prime }; say $s; say now - INIT now` takes 10s on gmp branch, 30s on master 20:55
yeah, no change in spectest time 20:58
AlexDaniel MasterDuke: btw I think there's third chunk of 90% for switching to gmp rats :) But that's for later
21:01 xinming left 21:02 xinming joined 21:08 rindolf left, Altai-man left 21:10 BenGoldberg joined 21:18 Xliff joined, Xliff left, Xliff joined 21:19 xinming left, xinming joined
[Coke] MasterDuke++ 21:28
22:06 perryprog left, perryprog joined 22:20 BenGoldberg left 22:23 mowcat joined 22:28 lucasb joined 22:47 abraxxa joined 22:51 ggoebel left 23:03 dotdotdot left 23:10 dotdotdot joined 23:16 cgfbee left 23:18 xinming left 23:19 xinming joined 23:22 mid_laptop joined 23:23 El_Che left 23:24 ensamvarg left, gordonfish left, cgfbee joined, kybr left 23:25 Util left, kybr joined 23:26 Util joined, ensamvarg joined 23:28 colomon__ left, El_Che joined 23:35 colomon joined, colomon left 23:36 vrurg joined 23:37 pecastro left 23:41 vrurg left 23:43 xkr47 left 23:45 lizmat left
Xliff Huh, 23:47
This is an odd error... "Can only store CPointer attribute in CPointer slot in CStruct" 23:48
m: use NativeCall; class A is CStruct { has Pointer $.a }; my $a = A.new; $a := Pointer
camelia 5===SORRY!5=== Error while compiling <tmp>
'A' cannot inherit from 'CStruct' because it is unknown.
at <tmp>:1
Xliff m: use NativeCall; class A is repr<CStruct> { has Pointer $.a }; my $a = A.new; $a := Pointer
camelia ( no output )
23:48 lizmat joined
Xliff m: use NativeCall; class A is repr<CStruct> { has Pointer $.a }; my $a = A.new; $a := Pointer[uint8].new(1) 23:49
camelia ( no output )
23:55 xkr47 joined 23:57 Xliff left 23:58 andreoss joined