🦋 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.
guifa2 Xliff: I haven't yet, but I'm about to switch to it. The main XML lib is painfully slow because of the way it does mixins 00:57
Xliff Yes. I understand that mixins can be very slow. 01:15
At least until the new compiler change (supposedly) fixes this.
guifa2: What are you working on, if I may ask? 01:16
tellable6 Xliff, I'll pass your message to guifa2
guifa2 o/ 05:46
tellable6 2021-01-24T01:16:14Z #raku <Xliff> guifa2: What are you working on, if I may ask?
guifa2 Xliff: I'm parsing the CLDR into a compressed/efficient format 05:47
It takes it about 20-30 seconds to handle each one, and the XML operations are a large portion of that (based on profiling, it's the "but" mixins that are killing it) 05:48
Xliff Ah. I'm doing that a lot in my current projects. 05:50
So I take it using "but" is a significant performance hit?
It 05:51
Ah, the timing couldn't be more auspicious. We're both working in XML. You with CLDR and me with Amazon AWS EC2 api and my GUPnP bindings (wiki.gnome.org/Projects/GUPnP)
My current work is showing progress... see github.com/Xliff/p6-GUPnP 05:52
guifa2 Xliff: using but once or twice probably doesn't have huge implications, but the way XML (as opposed to LibXML), it does lots of substring operations that are then butted to add on the XML-ish roles 06:54
Xliff Oh, ouch! 07:04
guifa2 Yeah. I was a bit relieved to know it wasn't my code, although since it's all in a preprocessing phase, it's not the end of the world 07:23
ugh
speaking of long times
my FOSDEM talk is a solid 10 minutes over 07:24
guifa2 wonders what he can cut
scratch that, I'm oevr by 15 minutes! :-( 07:26
Xliff Ah. 07:29
Have fun at FOSDEM!
What's your talk going to be about?
guifa2 Basically how to make a smart module 07:31
but also an ode to Raku's elegance
Xliff A smart module? 07:48
guifa2 smart = one that is very Raku-ish and user friendly 08:03
I'll probably do a text-based guide at some point too 08:13
.tell jmerelo I've got the talk down to 52 minutes, exporting the video but looks like my laptop will take a bit. Sleeping now but will upload it in the AM and see if I can cut down a few more minutes to do an afternoon upload 08:14
tellable6 guifa2, I'll pass your message to jmerelo
ens i am also doing some stuff and need to parse some xml from an rss feed 08:41
ens is there a way to see larry's fosdem talk online? I heard he gave an entire talk with in analogies to lord of the rings. 09:12
El_Che sadly, the FOSDEM recording was lost/failed 10:36
and he did (I was there)
lizmat a while ago Andrew Shitov posted his (bootleg) audio recording of Larry's talk 11:17
ens i am a bit new. i am trying to do some regexes on some stuff i'm getting back from: my $content = LWP::Simple.get($url); 13:01
but it just seems to not really like it. Also when i try to 'say $content' it comes out as hex (but the hex data looks correct) 13:02
do i need to convert it from a Buf to something else first?
ens tugs on raku-channel sleeve 14:19
halp
Tirifto[m] ens: I’m a bit new, too, but I’ll try to reproduce! 14:23
ens thanks Tirifto[m] . i think i found something that might solve this.
perl6advent.wordpress.com/2011/12/...binary-io/
this says i can do $str = $content.decode('UTF-8') to convert it
i kinda wonder if this is the correct approach... but it seems to work at least! 14:24
Xliff ens: Sorry I didn't see your call for help sooner. From Buf to something Stringy is as simple as $buf.decode. UTF-8 is the default so you don't need to specify it. 14:29
You coudl also do something like $buf.decode('ASCII') if that buffer is encoded in that way. 14:30
ens thanks Xliff 14:32
Tirifto[m] I’m guessing it returns something Buf since a webpage could use any of the various encodings? 14:35
ens what i find slightly amusing then is that the encoding is given in text "<?xml version="1.0" encoding="UTF-8"?>" which means i have to convert to a string in order to know what encoding it is. 14:37
but i guess it is easy enough to just check the page and just use that and presume it won't change any time soon. 14:38
timotimo xml is specified as a binary format i think? 14:45
hm. that would be very weird with utf16 or ucs16
actually 14:47
i do not wish to find out 14:48
but the http result message should also contain a Content-Type that can include an encoding
ens that makes sense i suppose. 14:55
my next challenge is to parse this xml data. I have decided that it is not the best idea to use a regexp 14:56
so i am now using XML::Parser::Tiny
I feed it this: pastebin.com/tBXZyLpN and the result structure looks like this: pastebin.com/Z06eUcy8
kiti_nomad[m] I often fail to install modules with cpan, and often fail with cpanm. But I use the option --force but almost all succeed. So why does the regular installation make any sense? 14:57
ens i'm trying to extract <news:title> and <news:publication_date> from the listing.
looks like i need to get an array of all things under '<urlset>' tag and then i suppose it would be the element under <url> in each of those. inside that get into <news:news> and get the relevant tags under there. 15:00
Tirifto[m] ens: I searched for a bit and ended up looking at the standard. Apparently it’s best if you get the enocding information externally, but since the internal declaration comes at the beginning of the file, XML parsers should be able to figure it out with some magic.
ens hrm. so i am doing: my $tree = $parser.parse($xml); 15:25
#say $tree.perl;
my %t = $tree; my %body = %t{':body'}; say %body.perl; 15:26
it says: Odd number of elements found where hash initializer expected: Only saw 1 element in block <unit> at ./h.p6 line 28 15:27
but in the dumped structure it says the stuff under :body should be a hash...
Tirifto[m] ens: Shouldn’t it be just %t{'body'}, without the colon? 15:33
ens progress! thanks. 15:35
Tirifto[m] I think the output was just using one of the many syntaxes for Pairs: docs.raku.org/type/Pair 15:36
ens so hashes are classes with methods in raku. that is nice 15:51
Tirifto[m] It is! I think everything can be regarded as an object in Raku. :-) 15:54
Tirifto[m] By the way: Does someone know of a way to convert a string into a regular expression? For example, ‘\w+’ into /\w+/? I have read about regex interpolation, but that doesn’t seem to do what I want: 16:01
p6: my $h = ‘H.y’; my $r = / <$h> ‘ ’ Jude /; say(‘Hey Jude’ ~~ $r); $h = ‘Hi’; say(‘Hey Jude’ ~~ $r);
camelia 「Hey Jude」
Nil
moritz Tirifto[m]: my $rx = rx/<$r>/ 16:02
Tirifto[m]: also, now I have that song in my head. Thanks :/ :-) 16:03
Tirifto[m] moritz: The problem seems to persist for me, meaning that instead of interpolating the variable into the regex at the time of creation, it is interpolated anew whenever the regex is used. (Like so, it feels as if the variable were dynamic.) 16:04
moritz: And of course, you are welcome. :P 16:05
(In this particular example, I’d like for $r to never look at $h again, that is for the regex to keep matching /H.y ‘ ’ Jude/, even if $h changes or disapperas.) 16:07
cog_ m : say $*KERNEL.signals 16:21
m: say $*KERNEL.signals
camelia [(Any) SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGBUS SIGFPE SIGKILL SIGUSR1 SIGSEGV SIGUSR2 SIGPIPE SIGALRM SIGTERM SIGSTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ SIGVTALRM SIGPROF SIGWINCH SIGIO SIGPWR SIGSYS T…
cog_ m: say $*KERNEL.signals[*-1] 16:22
camelia True
cog_ Why the Any at the start and the true at the end ?
lizmat cog_ : the Any at the beginning is to allow for easier indexing: there is no signal 0 I believe (at least not trappable) 16:59
as to why the last one is True, I have no idea 17:01
guifa2 Tirifto[m]: if you need to freeze the regex in place, you can use an enclosure. But regexen are just specialized code blocks, that's why the variable is evaluated several times over 17:06
Tirifto[m] guifa2: What do you mean by enclosure? I tried enclosing it in a block to see if that was what you meant, and it seems to work if I prefix it with ‘do’, but I’m not sure why. :P 17:19
p6: my $r = do { my $h = ‘H.y’; rx/ <$h> ‘ ’ Jude / }; say(‘Hey Jude’ ~~ $r); my $h = ‘Hi’; say(‘Hey Jude’ ~~ $r);
camelia 「Hey Jude」
「Hey Jude」
guifa2 Tirifto[m]: I mean like this: my $h = ‘H.y’; my $r; {my $temp = $h; $r = / <$temp> ‘ ’ Jude /}; say(‘Hey Jude’ ~~ $r); $h = ‘Hi’; say(‘Hey Jude’ ~~ $r); 17:30
the $temp value is enclosed in that block, and never changes
Tirifto[m] Ohhh, I see now! I guess what I wrote amounts to the same thing then. 17:34
guifa2: Once again, thanks for help! :-) 17:35
cog_ Thx, lizmat 17:38
lizmat cog_ the last True feels like a bug BTW
cog_ Lizmat: bug true of Big Sur as well, btw 17:39
lizmat same on Mojave fwiw
or on Linux, as that is what camelia runs on 17:40
guifa2 just realized he called lizmat "lizmat" in his presentation. naming fail 17:41
cog_ On a related note, what is the equivalent of perl waitpid ? The doc does not help. docs.raku.org/language/5to6-perlfu...-_perlfunc
guifa2 (although I imagine all tech conferences have the issue of username vs real name) 17:42
moritz cog_: if you spawn a program with Proc::Async, you can await the promise that it returns
there's also a POSIX module if you need the C-level function 17:43
cog_ Motitzm that makes sense. Btw, he raku doc is lacking in that area if you try to enter it thru the signal perspective 17:44
mario__ Hi 18:06
El_Che ik was de elek offertes aan het bekijken 18:51
de elektricien: doe je iets met IT?
omdat utp6 in offerte stond :)
voor bureau beneden en AP heb ik kabel voorzien
ik vraag met af of ik utp ga voorzien in de slaapkamers (waar kinderen hun bureau hebben) 18:52
oops 18:53
ignore the dutch
:)
(and if understand it, feel free to advice me :) )
gfldex lolibloggedalittle: gfldex.wordpress.com/2021/01/24/chain-calling/ 21:13
Xliff There is a .chain, gfldex? 21:20
gfldex++ # Nice post! 21:21
notagoodidea Is it someone that can replicate a weird behavior from the REPL + Linenoise? (It is coming from Linenoise, I am pretty sure) 21:47
To replicate : type "foo é " and backspace to remove the space after "é". The cursor will stay at the same position. 21:50
notagoodidea And typing backspace again will remove the é but the cursor will be where the space was so at a +1 position as if "é" was treated like 2 characters. 21:50
and if you type other stuff after and hit backspace to delete a space or a character, it will realign the line correctly. 21:52
tony-o likely a terminal issue 22:19
doesn't happen for me in iterm
notagoodidea I am using kitty + fish
tobs .oO( you won't have that fish for long then ) 22:20
notagoodidea :D
tony-o disregard, it loaded readline - that happens on iterm2 too. 22:21
it doesn't muck up the spacing but does do some weird character stuff
notagoodidea m: my %outer = 1, 2 Z=> <a b>; my %inner = 1 Z=> 'x'; say %outer <<~>> %inner; say %outer >>~<<; say %outer >>~>> %inner; 22:34
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing required term after infix
at <tmp>:1
------> 3ay %outer <<~>> %inner; say %outer >>~<<7⏏5; say %outer >>~>> %inner;
expecting any of:
prefix
term
notagoodidea tony-o: I am not sure how Linenoise handle multi-bytes characters or if treats them as a sum of 2 asci characters "«" being "<<" and "é" being "'e". 22:36
hum. it seems that Linenoise (the C lib) don't have UTF-8 support. 22:37
tony-o guess it's not a bug 22:40