🦋 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.
japhb camelia: my $a = chr(0x41); my $ring = chr(0x30a); my $a-with-ring = $a ~ $ring; my $angstrom = chr(0x212b); my $insert = 'AB'; substr-rw($insert, 1, 0) = $ring; for $a, $ring, $a-with-ring, $angstrom, $insert { say "$_: { .ords.map(*.fmt('%X')) }" } 01:28
m: my $a = chr(0x41); my $ring = chr(0x30a); my $a-with-ring = $a ~ $ring; my $angstrom = chr(0x212b); my $insert = 'AB'; substr-rw($insert, 1, 0) = $ring; for $a, $ring, $a-with-ring, $angstrom, $insert { say "$_: { .ords.map(*.fmt('%X')) }" } 01:29
camelia A: 41␤̊: 30A
Å: C5
Å: C5
ÅB: C5 42
japhb That's promising at least -- I can create from codepoints, or even insert into the middle of a string, and it canonicalizes across the boundary. 01:30
elcaro codesections: I found - on windows at least - I could not paste unicode glyphs into Alacritty 02:02
I believe there's a GH issue on Alacritty repo to add proper unicode support, so my take-away was the Unicode support was not great
codesections Interesting. I used mlterm for a bit – and claiming good unicode support is almost their whole deal – but was still getting errors after extensive troubleshooting. And they all went away with the default config on alacritty 02:06
codesections shrug
Froogal How are dependencies handled in Raku modules?  By zef? 03:29
I want to write a Module that relies on WWW and multiple other modules.
summerisle zef, yes. use mi6 to set up your project structure and it should generally be a breeze from there, in my experience 03:31
guifa2 in your meta6.json, there's an entry for dependencies. if someone installs your module using zef
zef will check each dependency, and see if they're present at the required ver/auth. If not, it'll fetch them 03:32
Froogal cool beans!  Raku is such a breeze to work with so far lol
summerisle integrating native code (e.g. stuff that needs to go VERY fast such as checksums) into the build process can be a bit cumbersome, but the resources system makes loading it easier once you deal with the build 03:35
better than XS, which I have never really touched 03:36
guifa2 I'm actually going to be writing a whole how-to on making a module 03:37
Froogal guifa2 cool!  I would love to take a look 03:38
guifa2 but it'sonly about 20-25% done. Basing it on the units formatter
Froogal sumerisle whats XS?
summerisle
summerisle XS is a set of tooling and macros used to build native code that integrates with Perl 5 code 03:39
perldoc.perl.org/perlxs
better than having to do piles of heavy lifting to go between managed and native code, but still not as good as NativeCall in Raku 03:40
and i have been buried in nativecall for most of february
guifa2 codesections: oh, if you have a commit bit, github.com/Raku/ecosystem/pull/582 ? (I feel dirty committing my own things so lol) 03:41
Froogal: github.com/alabamenhu/IntlFormatUn...ng-of-1.md <-- part one, but this doesn't really talk about the module making yet at all 03:46
Froogal guifa2 sweet!  Thanks 03:47
gfldex lolibloggedalittle: gfldex.wordpress.com/2021/02/17/method-ish/ 10:27
PimDaniel Hello. 15:18
\o
Has an Opcroft and Karp Algorithm been implemented into Raku? 15:19
It is an algorithm to find the maximum matches in a bipartit graph. 15:20
Just to know because one exist in Python and i'm about to rewrite it in Raku but if it has been already done : i'll loose my time. Thank's. 15:22
sena_kun PimDaniel, I doubt it is (see no libraries nor snippets), so feel free to port && release a library. 15:23
PimDaniel Thank's sena_kun, ok, i'll try that! 15:24
jmerelo There's still time to suggest new ideas for Google Summer of Code perl-foundation-outreach.github.io...021-ideas/ or to volunteer as a mentor, should it be funded 18:16
tonyo jmerelo: i can mentor on rakumod 18:18
or just do it 18:19
jmerelo tonyo: Can you please add yourself to the project via PR? Thanks a lot... 18:21
TBH honest, someone doing it is probably the shortest path... But still, if someone is interested enough in a project to actually do it, they would make a great mentor too :-) 18:22
tonyo where do i send the PR? 18:24
codesections And there's always the (not tiny) chance that a mentee turns into a long-term contributor
tonyo fewer users means fewer bugs discovered
as uses approaches zero .. 18:25
how do you have 1k repos jmerelo , holy s
perry Holy moly 18:26
codesections "fewer users"? 18:27
tonyo making a joke codesections
codesections ah. I guess I don't get it, but explaining would probably kill it. so nvm 18:28
jmerelo tonyo: I do _everything_ in GitHub. Classes, talks... novels. 18:29
tonyo PR here github.com/perl-foundation-outreac...akumods.md
tonyo sent 18:30
jmerelo tonyo: if you want to take the lead, I'd gladly step aside. Anyway, that's all dependent on Google footing the bill and someone picking up that project. Checking the PR 18:31
Accepting the PR. Thanks!
tonyo i'm wholly unfamiliar with the gsoc stuff, if the lead is just helping someone in writing code then i can do that. if it involves dealing with google or whoever then i'm likely not a good candidate for that. 18:33
PimDaniel hi 18:35
Hi all! I really cannot see what is the difference between @list = (1,2,3); and @list = [1,2,3];
summerisle m: (1,2,3).WHAT.say; [1,2,3].WHAT.say
camelia (List)
(Array)
PimDaniel So there's none differences. 18:36
summerisle well, sort of
PimDaniel An array is a list of thing and a list too.
summerisle The semantics of a List are Different from an array. Lists are immutable, where arrays are not, for instance. 18:37
PimDaniel But why lists are immutables? What are they aimed for?
jmerelo tonyo: well, it involves at least a mid-term report. But leading the project need not include writing reports. So we'll see when we get there.
summerisle PimDaniel: sequences of data, potentially lazy sequences, etc... there are occasions where you might want immutability 18:38
with that having been said, assigning a list to an array container (@) will convert the list to an array
m: my @was-list = (1,2,3); @was-list.WHAT.say
camelia (Array)
jmerelo PimDaniel: many basic data structures are inmutable, but they have a mutable version. It's Array in the case of lists
codesections Many programmers (esp. those who like functional programming) see advantages in immutable data structures, so Raku provides a lot. 18:39
jmerelo summerisle: it will if there's no further qualification. The @ sigil implies Positional; but its type can include lists or Arrays.
summerisle right
jmerelo m: my @this-is-a-list is List = (1,2,3); say @this-is-a-list 18:40
camelia (1 2 3)
jmerelo m: my @this-is-an-array-maybe = (1,2,3); say @this-is-an-array-maybe
camelia [1 2 3]
PimDaniel I could observe my problem when i declared a hash with %(a => ('b','c','d'), ...); then wanted to add an element value to a! should i use [] instead?
codesections List => immutable Array; Map => immutable Hash; Bag => immutable BagHash, etc 18:41
jmerelo PimDaniel: right. [] are arrays
(as seen above)
PimDaniel The problem is when between constants literal passed as parameters and variables. I think i see. 18:43
Another question in the same time: 18:44
if i want to add a new key to an hash:
In perl5 i could do this : push @{$h{$key}} , @values , then key $key was created if it did not exits. 18:46
jmerelo PimDaniel: you can simply do @hash{$key} = "Whatever" 18:47
summerisle %hash{key}.push: value appears to work as well
jmerelo summerisle: that will push to whatever is in %hash{$key}
summerisle I think that's what PimDaniel wants
m: my %h; %h<key>.push('value1'); %h.gist.say 18:48
camelia {key => [value1]}
PimDaniel No in Raku in my loop does not work anymore directly , i must first do %h{$key} = [];, then push.
jmerelo PimDaniel:you're pushing to the value, not to the hash
as you see above, it's created an array with a single value, "value1" 18:49
PimDaniel my model is a hash , each key containing an array
jmerelo PimDaniel: Ah, OK. Then what summerisle has just said would work. Or use append if you want to add a whole array. 18:50
PimDaniel so i push this way : push @(%h{$key}), $new_value;
jmerelo m: my %h; %h<key>.append: <foo bar baz>; %h.say
camelia {key => [foo bar baz]}
summerisle you don't need to do @()
raku is a little smarter about container semantics than perl 5 18:51
and the use of references for nesting is no longer necessary
PimDaniel ok i know this.
so %h{$key}.append? 18:52
summerisle should do the trick
PimDaniel so %h{$key}.append: $value?
summerisle for a single value you might use .push instead 18:53
but append will work as well
PimDaniel Haaa ok it works, it works, ça marche , ça marche! i earned 4 lines of code. 18:54
Thanks very much to each of you for this clarification. 18:55
ab5tract m: my %h; %h<foo>.push: "hi"; %h<foo>.push: "bye"; dd %h 19:35
camelia Hash %h = {:foo($["hi", "bye"])}
ab5tract ok, so .append is only about slip-ping 19:37
m: my %h; %h<foo>.push: "hi"; %h<foo>.push: "bye"; %h<foo>.push: <some more data>; %h<foo>.append: <even a bit more>; dd %h 19:38
camelia Hash %h = {:foo($["hi", "bye", ("some", "more", "data"), "even", "a", "bit", "more"])}
ab5tract anyone know off the top of their head how to get the number of lines in an open text file handle without ingesting them first? 20:04
tadzik I don't think you can :/ 20:05
you can guesstimate if you know the length of the first one and can assume that they have similar length
ab5tract tadzik, interesting, how would that work? something about total bytes divided by approximate bytes per line? 20:06
tadzik ab5tract: yeah
ab5tract hmm, tbh shelling out to `wc` feels less hacky than that :)
tadzik wc is just going to ingest them for yuo ;) 20:07
codesections ab5tract: agreed. Not "don't think you can" in the weak sense of "I don't know if anyone has built a way to do that", but in the stronger sense of "if I'm not mistaken, that's impossible in principle"
tonyo you could sort all of the characters and then count them that way 20:08
tadzik nod nod. Files don't really have lines
tonyo that'd be a hackier way to ingest them and be more inefficient
ab5tract tadzik, true but wc can do it in a fraction of the time it takes raku, unfortunately 20:09
tadzik right
ab5tract I'm playing around with allCountries.txt from geonames.org. only about 12 million lines
tadzik sheesh 20:10
well, you already know the number, just hardcode it :P 20:11
ab5tract use case for knowing the number of lines in the file is to then feed $core number of promises each taking 12 million / $core lines to take ingest via Text::CSV
I'm curious to see what kind of performance we get against node.js 20:14
and then to become truly ashamed, I will test against q 20:15
tonyo you could pre break the lines into separate files and then count them that way 20:25
[0..*].line 20:26
ab5tract Decoder may not be used concurrently 20:29
:/
tonyo not with that attitude 20:30
ab5tract lol
does Tux still hangout sometimes?
tonyo you parsing CSV files?
ab5tract indeed I am 20:31
tonyo his csv repo was last updated in oct last year 20:32
ab5tract to be honest I'm a bit impressed that he figured out how to issue a die when the decoder is being created in more than one thread
tonyo looks like he removed csv-parser from his benchmarks :_ 20:33
ab5tract tonyo, maybe it's just me that hasn't been around for a long while... but I used to enjoy him jumping on here with the latest benchmarks
oh? :(
ab5tract remembers when tonyo was tony-o 20:34
tonyo err oh maybe not, just hasn't been updated since 2015
i had to reinvent myself
ab5tract it's healthy to die every once and a while 20:37
hm, all I'm doing is splitting each line by "\t" .. maybe I can skip the library and get the multi-threading 20:38
ok, that went a lot .. lot .. faster than I expected 20:44
codesections if I want `?$a-string` to equal False, the normal way I'd do it is `my $a-string = 'some text' but False`. But that pays the performance cost of mixing in the entire Bool type -- is there a faster way to do it if I don't need anything else from Bool? 20:46
ab5tract that was on the much smaller, < 1 million line file
now I'm watching my swap space fill up, max'd ram 20:47
codesections (this is for relatively hot code, so I'm willing to dip into lower-level/MOP stuff if need be)
japhb codesections: Subclass Str and hardcode `method Bool { False }`? 20:58
codesections japhb: I was actually playing around with that, but I didn't see a way to make that work with literal string assignment. 21:00
meh, probably not worth it. Mixing in False isn't *that* expesive 21:01
ab5tract I'm going to go out on a limb here and say that it probably shouldn't tak 15GB+ of memory to 'my @data = "1.6GB-File".IO.lines' 21:08
does it really cost us 10x ? 21:09
is it possible to imagine that .lines could be implemented in a streaming manner? 21:10
guifa o/ 21:13
ab5tract hi guifa, hows it going? 21:21
guifa Not too bad. Finally getting to a slower point at $day-job so I can get back to more Raku dev ^_^ 21:23
MasterDuke ab5stract: Tux still does post his benchmark timings most days, but in #raku-dev 21:58
MasterDuke ab5tract: Tux still does post his benchmark timings most days, but in #raku-dev 21:58
tellable6 MasterDuke, I'll pass your message to ab5tract
SmokeMachine vrurg: Sorry, but I'm curious: are you using Cro + Red with Cro::HTTP::Session::Red? 23:10
vrurg SmokeMachine: trying it, yes.
SmokeMachine vrurg: please, let me know if I can help somehow 23:11
vrurg SmokeMachine: thanks! The refresh was already very helpful. :) 23:13
SmokeMachine vrurg: are you finding something hard to be done? something we could get better? 23:20
vrurg SmokeMachine: Not really. 23:22
vrurg currently struggles with session cookie + session expiration + websockets closing on time. 23:23
guifa How does the is repr(CStruct) trait handled? Do there end up being two representations of the class — a blob for a separate Raku version — or is there just the blob for C and that gets converted on the fly to P6Opaque, etc, when accessed via a method accessor? 23:43