🦋 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:08 reportable6 left, reportable6 joined 01:08 shareable6 left, unicodable6 left, committable6 left, tellable6 left, quotable6 left, nativecallable6 left, evalable6 left, linkable6 left, statisfiable6 left, bisectable6 left, reportable6 left, notable6 left, releasable6 left, sourceable6 left, benchable6 left, bloatable6 left, coverable6 left, greppable6 left 01:09 greppable6 joined, reportable6 joined, nativecallable6 joined, statisfiable6 joined 01:10 notable6 joined, bloatable6 joined, releasable6 joined, evalable6 joined, coverable6 joined, unicodable6 joined, sourceable6 joined 01:11 shareable6 joined, benchable6 joined, tellable6 joined, quotable6 joined, bisectable6 joined, committable6 joined, linkable6 joined 02:11 benchable6 left, linkable6 left, sourceable6 left, quotable6 left, committable6 left, tellable6 left, releasable6 left, coverable6 left, greppable6 left, unicodable6 left, bisectable6 left, statisfiable6 left, notable6 left, evalable6 left, bloatable6 left, shareable6 left, reportable6 left, nativecallable6 left 02:12 shareable6 joined, committable6 joined, sourceable6 joined, releasable6 joined, bisectable6 joined, coverable6 joined 02:13 benchable6 joined, tellable6 joined, unicodable6 joined, notable6 joined, evalable6 joined 02:14 statisfiable6 joined, nativecallable6 joined, greppable6 joined, reportable6 joined, linkable6 joined, bloatable6 joined, quotable6 joined 02:53 abraxxa-home left
xinming SmokeMachine: termbin.com/a11h <-- This is the test script to trigger the issue. 03:08
when running the script, a db named test_record_db will be dropped and then created 03:18
03:53 linkable6 left, evalable6 left 03:54 evalable6 joined 03:55 linkable6 joined 04:13 nebuchad` joined, andinus` joined 04:14 andinus left, nebuchadnezzar left 04:51 Xliff joined
Xliff \o 04:52
tellable6 2022-06-06T01:45:58Z #raku-dev <vrurg> Xliff github.com/rakudo/rakudo/issues/49...1146947454 – this might be of interest for you.
Xliff m: package A { our enum abc <a b c> is export }; import A; 04:54
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> package A { our enum abc <a b c>⏏ is export }; import A;
expecting any of:
infix stopper
Xliff m: package A { our enum abc <a b c> is export; }; import A;
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> package A { our enum abc <a b c>⏏ is export; }; import A;
expecting any of:
infix stopper
Xliff m: package A { our enum abc is export <a b c> }; import A; 04:55
camelia ( no output )
Xliff m: package A { our enum abc is export <a b c> }; import A; abc.enums.say
camelia Map.new((a => 0, b => 1, c => 2))
Xliff m: package A { our enum abc is export <a b c> }; import A; abc.enums.say; abc.^name.say
camelia Map.new((a => 0, b => 1, c => 2))
Xliff ^^ How can I get the package name of enum abc?
05:26 nebuchad` is now known as nebuchadnezzar 06:07 reportable6 left, reportable6 joined 06:32 Oshawott joined 06:35 archenoth left 06:58 Sgeo left 07:12 lichtkind_ joined 07:24 MikeyHoef joined 07:29 ocomporto left 07:49 abraxxa joined 07:53 abraxxa left 08:03 abraxxa joined 08:07 abraxxa left 08:08 abraxxa joined 09:06 Kaiepi left 09:26 Kaiepi joined 09:34 Sankalp left 09:35 Sankalp joined
Nemokosch Is it just me or `div` not ensuring numeric context is pretty inconsistent with overall design? 09:50
09:52 discord-raku-bot left, discord-raku-bot joined
It's not really nice. I wouldn't even use `div` if normal division weren't considerably slower 09:54
Xliff m: package A { our enum abc is export <a b c> }; import A; abc.enums.say; abc.^name.say 10:00
camelia Map.new((a => 0, b => 1, c => 2))
Xliff ^^ How can I get the package name of enum abc?
MasterDuke Nemokosch: what do you mean about numeric context? 10:07
tellable6 MasterDuke, I'll pass your message to Nemokosch
Nemokosch '6' / 2 is 3, except it's a Rat and not a performant operation overall 10:09
'6' div 2 on the other hand is an error
I want to use div for the sole reason / is proven to be not performant enough 10:10
calling div= in particular so no, most calls won't need the conversion 10:11
MasterDuke `/` has github.com/rakudo/rakudo/blob/mast....pm6#L228, but there's no equivalent for `div` 10:12
Nemokosch $n div $m should at least attempt to convert to Int, if it only operates on Int 10:13
probably the same for mod 10:15
in the large list of operators, I rarely see operators that do not coerce 10:16
10:16 MARTIMM joined
MasterDuke i think someone pointed out the apparent inconsistency on the mailing list a little while ago, but i don't believe anything became of it 10:16
Nemokosch I'm not even saying if this approach of coercions is good or not but I am saying that given this approach, it's inconsistent to rule out `div` and `mod` 10:17
Can I open an issue for this? 10:19
MasterDuke sure
Nemokosch 👍 10:20
10:22 discord-raku-bot left, discord-raku-bot joined 10:24 frost joined
MasterDuke fwiw, adding a new multi for infix:<div> that coerces to Int passes a spectest and makes `say "6" div 2` return 3 10:27
10:29 discord-raku-bot left, discord-raku-bot joined 10:39 MARTIMM left
Nemokosch in fact, even gcd coerces... 10:48
done 11:04
under Problem-Solving as this related to language design
11:10 frost left 11:33 frost joined 11:43 lichtkind_ left
Xliff m: package A { our enum abc is export <a b c> }; import A; abc.enums.say; abc.^name.say 12:01
camelia Map.new((a => 0, b => 1, c => 2))
Xliff ^^ How can I get the package name of enum abc?
MasterDuke m: package A { our sub foo() is export { say "hi" } }; import A; say &foo.package 12:03
camelia (A)
MasterDuke Routines have a `.package`, but most things don't. i'm not sure how to do it for the enum 12:04
Xliff Yeah. That's what I noticed.
That seems to be a bit of an oversight.
I've even tried punning a role that would contain the package name, but enums cannot take a role, either. 12:06
m: role B { }; package A { our enum abc is export <a b c> }; import A; abc does B;
camelia Cannot use 'does' operator on a type object abc.
in block <unit> at <tmp> line 1
12:07 reportable6 left 12:08 reportable6 joined 12:20 jjido joined 12:40 jjido left 13:22 morte_ joined 13:26 abraxxa left 13:27 abraxxa joined 13:28 jgaz joined 13:32 abraxxa left, abraxxa joined 13:53 Kaiepi left 13:55 morte_ left 14:04 p6steve joined 14:07 frost left 14:08 archenoth joined 14:10 Oshawott left 14:14 lizmat joined 14:21 morte_ joined
p6steve hi! what's the best way to test for num32 / num64? 14:29
14:29 lizmat_ joined
p6steve [need to determine this to make CArray[num32] or CArray[num64] ] 14:30
moritz what do you want to test for num32/num64? 14:31
14:32 lizmat left 14:33 lizmat_ is now known as lizmat
lizmat clickbaits rakudoweekly.blog/2022/06/06/2022-...y-release/ 14:34
14:38 lizmat left, lizmat joined
p6steve moritz: I want to use NativeCall CArray to send data to populate a Rust / Polars Series object 14:41
moritz: so I need to specify if I have a CArray[num32] or a CArray[num64] 14:42
I have thought of .min/.max vs. the extreme values of num32, but... 14:43
m:[1, 3, 5, NaN, Inf, 6, 8].max.say
evalable6 NaN
p6steve m:[1, 3, 5, Inf, 6, 8].max.say
evalable6 Inf
14:45 xcanehan joined
moritz let the user decide, no? 14:45
that probably know better what precision they need than you 14:46
14:47 Sgeo joined
moritz *they 14:47
Voldenet .max is not valid either way, your best bet is to use num64 and let users specify 14:51
the simplest way is to convert every value to single precision, then double and afterwards compare if single precision result matches double precision 14:54
[Coke] folks, could use more eyes on the upcoming revision of the doc site, please ping me if you have some time to review the changes. 14:56
Voldenet m: use NativeCall; sub Create(:$type = num64) { CArray[$type].new([10e0,1e30]).map(*.say).sink }; Create(); Create(:type(num32))
camelia 10
p6steve moritz: tempted by user knows argument, but the tradition in Pandas/Polars is Series.new([1,2,3...]); and I think forcing user to specify makes API more complex
moritz p6steve: you don't have to force the user, you can just default to one, and let the user specify an option to select the other 14:58
but the num32/num64 choice isn't just about possible range, but also about precision; and you cannot infer the user's need for precision based on their data
p6steve Voldenet: surely min/max are faster / less memory than converting every entry (some dataframes are order 50GB ... not that I'm attempting this scale yet ;-) 14:59
Voldenet but min/max is invalid in terms of precision, as you can see
1e30 "fits" in num32
I think pandas use float64 by default 15:00
nine p6steve: then go with num64 as a safe default and offer options to work with reduced precision 15:01
p6steve both: OK - I will default to num64 and provide option to [coerce to] num32 - this is probably a better target for Rats also (since they have higher precision than even num64) 15:03
Voldenet in fact, pandas handles NaN in int64 arrays, which may sound weird
p6steve Voldenet: yes ... this is just WRONG in many ways ... 15:04
Voldenet or maybe it was numpy, I'm not entirely sure 15:05
either way, people dealing with numbers know differences between data types
p6steve Voldenet: my initial design for OOTB Raku Dan Series is !!! untyped (and that the .dtype method is just an alias for .are) 15:06
Voldenet: Python Pandas uses the Numpy NAN as the universal "missing" value 15:07
Voldenet …and it's quite weird 15:08
p6steve Voldenet: IMO it is common to see users (and even coders) get confused about numeric data types (esp. decimals) 15:09
15:09 morte_ left 15:10 abraxxa-home joined
Voldenet It is common, because things like matlab silently handle it… somehow 15:11
p6steve now I think about it the cast and compare method is the only safe way (and even that may confound expectations)
Voldenet it's not the only safe way, the other safe way would be checking bitmasks 15:12
knowing the architecture's single/double precision numbers layout
p6steve I don't think so
There are a lot of denormalised numbers near the extremes 15:13
That's what I mean about confound - you may be lucky that your precision needs are met for the numbers you test, but not in general
15:16 xcanehan left
p6steve Really appreciate the feedback! 15:16
Voldenet m: use NativeCall; my $*num-type = num64; sub Create(:$type = $*num-type) { CArray[$type].new([10e0,1e30]).map(*.say).sink }; Create(); Create(:type(num32)); { my $*num-type = num32; Create(); } 15:17
camelia 10
Voldenet I consider this pretty sane
you don't have to care until you do
p6steve just to wax lyrical, both Pandas and Polars implement read_csv methods that parse columns of numbers into numbers ... I have not got under the hood on this ... don;t know if they handle Ints, what are defaults etc. ... AFAIK they do dates too 15:20
sooo - as it happens Raku is just awesome for this ... it's just OOTB (and lazy) 15:21
Voldenet: I like your example - will follow! 15:23
Voldenet (though i'd try to have pure C api and C-macros defined storage types) 15:25
(the reason is more control when representing something like `struct Num64 { double value; ChangeLog(Num64) * log; 15:31
which could really make debugging work easier
or rather `struct Num64 { double value; ChangeLog(struct Num64) log; };` 15:36
15:51 Kaiepi joined 16:51 notable6 left, bisectable6 left, tellable6 left, bloatable6 left, benchable6 left, quotable6 left, sourceable6 left, linkable6 left, coverable6 left, shareable6 left, nativecallable6 left, unicodable6 left, committable6 left, statisfiable6 left, reportable6 left, greppable6 left, evalable6 left, releasable6 left, shareable6 joined, greppable6 joined, benchable6 joined 16:52 sourceable6 joined, reportable6 joined, bisectable6 joined, coverable6 joined, unicodable6 joined, abraxxa left, nativecallable6 joined, statisfiable6 joined, releasable6 joined 16:53 evalable6 joined, bloatable6 joined, linkable6 joined, committable6 joined, notable6 joined, quotable6 joined 16:54 tellable6 joined
p6steve m:> sub xx( :$dtype ) { given $dtype {when num32 {say "yo"}} }; xx(dtype => num32); 17:24
evalable6 (exit code 1) 4===SORRY!4=== Er…
p6steve, Full output: gist.github.com/8fe6bd5cbf8a401853...7e38ad7d71
p6steve m:sub xx( :$dtype ) { given $dtype {when num32 {say "yo"}} }; xx(dtype => num32); 17:25
evalable6 yo
p6steve hmmm - this works here and in the repl on my machine, but not in my script 17:26
sienet_ja_LSD[m] p6steve: I tried that Dan module of yours, seems to work, but I wonder if it has matrix methods like outer product. or would you recommend using Math::Matrix instead for those kind of operations 17:28
p6steve sienet: thanks for giving it a spin - sorry that there is not much elaboration of the design / roadmap so far 17:32
sienet_ja_LSD[m] there's great potential atleast 17:34
p6steve sienet: in a nutshell, you have 3 modules Dan, Dan::Pandas and Dan::Polars - they have (largely) the same API
sienet_ja_LSD[m] I got to fix the python Inline thing, there were some errors installing it 17:36
p6steve sienet: suggest you take a look at the Dockerfile - I also had some issues (the Dan::Jupyter module should get you up with a Jupyter Notebook if you prefer) 17:38
sienet: so - Dan::Pandas is the history - interface via Inline::Python to Python Pandas --- we need this now for all 435 Pandas methods, to interop with Seaborn and Matplotlib etc 17:39
sienet_ja_LSD[m] my docker skills are extremely rusty, but I might try it out. jupyter is very usable
p6steve sienet: Dan is the future, I have deliberately kept the common API very minimal - and frankly I do not have the tuits to rebuild all of Pandas, the idea is to (i) modularize the API so that there is a base API [already "there"] 17:41
sienet_ja_LSD[m] yeah it will be nice
p6steve sienet: (ii) then we can have Mezzanine modules for aspects such as (SQL) Query, Math, Set, that largely work through (i) so that we can keep the base API focused and tuned 17:42
sienet_ja_LSD[m] so how does it work, if I want some statistical functions, is using the inline Pandas module the way to go? 17:43
installing Inline::Python errors ===> Searching for missing dependencies: python3:from<native> 17:44
No such method 'as' for invocant of type 'Any'
p6steve sienet: Dan::Polars is the present (but it is not ready yet!), why? because we need to apply some resource to build bridges to eg Math::Matrix ... and that will take too long (also Polars is fast)
sienet_ja_LSD[m] aye, ok nice 17:45
p6steve sienet: so until Dan::Polars is MVP, then the practical answer is please use Dan::Pandas for anything you need not in the base Dan API, or consider just useing the base Dan API directly.
sienet_ja_LSD[m] ok, well I'm going to need to report the zef installing error to get Inline::Python working 17:47
p6steve sienet: the base Dan API gives you transparent access to a native Raku M x N array eg. my \df = DataFrame.new(...), df.data, so you should be able to do something in MAth::Matrix like df1.data OP df2.data directly 17:48
sienet_ja_LSD[m] hmm, I'll try that, seems easier that way 17:49
p6steve sienet: then you can maybe go my \df3 = DataFrame.new( data => df1.data OP df2.data ) 17:50
sienet_ja_LSD[m] aye 17:51
p6steve sienet: sienet: try this zef install github.com/niner/Inline-Python.git --exclude="python3"
sienet: from here github.com/p6steve/raku-Dockerfile...Dockerfile
sienet_ja_LSD[m] nice, it did in fact install, thanks 17:52
17:54 evalable6 left, linkable6 left
sienet_ja_LSD[m] Dan::Pandas install errors though 17:55
17:56 linkable6 joined
sienet_ja_LSD[m] [Dan::Pandas] Invalid typename 'Dan::Series' in parameter declaration. [Dan::Pandas] ------> multi method new( Dan::Series:D⏏ \s ) { 17:56
[Dan::Pandas] expecting any of:
[Dan::Pandas] pair value
17:57 evalable6 joined
p6steve sienet: please can you post the error, maybe open an issue on Gh github.com/p6steve/raku-Dan-Pandas 17:57
sienet_ja_LSD[m] aye 17:59
p6steve sienet: what do you get from 'zef info Dan' ??
sienet_ja_LSD[m] - Info for: Dan... (full message at libera.ems.host/_matrix/media/r0/d...40fbc1454) 18:00
I opened up an issue 18:01
p6steve sienet: tx for posting it -- maybe try zef install --force-test Dan::Pandas 18:02
sienet: tx ...
sienet_ja_LSD[m] the error persists, line 73 of Dan::Pandas 18:03
18:07 reportable6 left 18:08 jjido joined
p6steve sienet: please can you add your kit (raku version & platform info) to the issue 18:08
sienet_ja_LSD[m] aye sure
18:09 reportable6 joined
p6steve maybe try zef install --verbose github.com/p6steve/raku-Dan-Pandas.git (not sure if fez has the latest) 18:09
sienet: otherwise, I will have to roll up my sleeves ... will revert via the issue 18:10
sienet_ja_LSD[m] added the infos 18:13
p6steve sienet: meantime here is a live jupyter notebook setup for your investigation (I only have one for now) container-service-1.gs7k0bfrb4gvk....l.com/lab? 18:21
the login token is fd4e8fac86a88a68e7201a1dd54ced42c1ad5a0836a739e9 18:22
sienet_ja_LSD[m] nice, thanks
p6steve sienet: don't worry about making changes and so on (there is a known glitch in here that the raku Jupyetr kernel will restart)
sienet_ja_LSD[m] oh ok 18:23
p6steve sienet: sorry think I was "fighting" you! 18:25
sienet_ja_LSD[m] hehe 18:26
p6steve sienet: also please do join the IPRC raku track if you can later in the month as I will be presenting some more info
tprc2022.sched.com/event/11nf9/rak...-dataframe 18:27
sienet_ja_LSD[m] aye I will
18:27 lichtkind joined 18:45 HobGoblin joined 18:46 kawaii_ joined, ecocode____ joined 18:47 PotatoGim_ joined 18:48 jcallen_ joined 18:49 El_Che_ joined 18:50 ecocode___ left, PotatoGim left, kawaii left, El_Che left, jcallen left, goblin left, kawaii_ is now known as kawaii, ecocode____ is now known as ecocode___, PotatoGim_ is now known as PotatoGim 19:39 vrurg left, vrurg joined 20:37 Geth left
[Coke] any ideas why File::Directory::Tree's rmtree might be failing under windows? 20:57
oh, because I'm an idiot. Nevermind. 20:59
21:00 lizmat left 21:04 jgaz left
phogg Using Windows can have that effect on people. 21:40
22:01 lizmat joined 22:05 lizmat left 22:12 jjido left 22:13 abraxxa-home left 23:09 jjido joined 23:43 Xliff left 23:44 lichtkind left
[Coke] (I had created a test for it to delete ages ago... that was a file, not a directory) 23:47
23:49 thowe left 23:53 jgaz joined