🦋 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.
leont There was a way in this channel to run a raku sniplet on a bunch of different versions, right? 00:21
guifa bisectable 00:30
leont bisectable: say sub foo(Str :@foo) { say "success" }.cando(\()) 00:38
bisectable6 leont, Will bisect the whole range automagically because no endpoints were provided, hang tight
leont, ¦6c (60 commits): «()␤»
leont, Nothing to bisect!
leont bisectable6: help
bisectable6 leont, Like this: bisectable6: old=2015.12 new=HEAD exit 1 if (^∞).grep({ last })[5] // 0 == 4 # See wiki for more examples: github.com/Raku/whateverable/wiki/Bisectable
leont bisectable6: old=2015.12 new=HEAD say sub foo(Str :@foo) { say "success" }.cando(\()) 00:39
bisectable6 leont, On both starting points (old=2015.12 new=3823f88) the exit code is 0 and the output is identical as well
leont, Output on both points: «()␤»
perryprog commit: say sub foo(Str :@foo) { say "success" }.cando(\())
committable6 perryprog, Seems like you forgot to specify a revision (will use “v6.c” instead of “say”)
perryprog, ¦v6.c (60 commits): «()␤»
perryprog commit: releases sub foo(Str :@foo) { say "success" }.cando(\())
leont should read the wiki first 00:40
committable6 perryprog, ¦releases (60 commits): «»
perryprog leont :(
leont bisectable6: old=2015.12 new=HEAD exit ?sub foo(Str :@foo) { say "success" }.cando(\())
bisectable6 leont, On both starting points (old=2015.12 new=3823f88) the exit code is 0 and the output is identical as well
leont, Output on both points: «»
leont commit: say sub foo(Str :@foo) { say "success" }.cando(\()) 00:41
committable6 leont, Seems like you forgot to specify a revision (will use “v6.c” instead of “say”)
leont commit: v6.c say sub foo(Str :@foo) { say "success" }.cando(\())
committable6 leont, ¦v6.c (60 commits): «()␤» 00:42
leont I really thought I had seen that work at some point, but apparently my memory is wrong
lucs Is there something like (elem) that could give me the index of the found element? 01:51
japhb lucs: (elem) is a set-like operator, and sets are unordered. Are you looking for something like .first(:k)? 01:53
moon-child m: say <a b c>.first('b', :k)
camelia 1
lucs japhb: I believe I am :-) 01:54
Thanks japhb and moon-child.
japhb :-)
moon-child one thing to watch out for: 0 is falsy. <a b c>.first('a', :k) is 0, <a b c>.first('d', :k) is Nil 01:55
lucs Gotcha.
guifa (one of the really nice differences between with and if. with requires a defined value — which Nil is not, but 0 is, so if you anticipate 0 or empty string/lists but not as falsey values, use with) 03:36
lucs tweaks his code. 03:39
Thanks for the reminder guifa :)
leont really likes combining with with named block arguments 04:04
«with some.expression() -> $value {}» is so much better than «if defined(my $value = some.expression()) {}» 04:05
lucs tweaks his code some more :) 04:07
leont (erm, I meant normal block arguments, these aren't named) 04:14
tbrowder howdy, folks 13:26
lizmat tbrowder o/
tbrowder you're up late! 13:28
lizmat ?? it's 2.30 pm here ? 13:28
tbrowder sorry, my tz sense is off!
lizmat
.oO( it's all relative )
tbrowder i've been working on tail end of my day more 13:29
i don't see much on 2d array in docs. do i remember seeing some syntax like @a[1;3]? 13:32
for row 1, col 3 13:33
Geth CCR: sjn++ created pull request #4:
Jnthn's presentation at NUUG, 2010-09-14
13:34
tbrowder or can we fake [][] using AT-POS somehow on a class
maybe back later today, bye-bye 13:38
lizmat make sure your outer AT-POS returns an object that the inner AT-POS can work on? 13:48
Anton Antonov I there a package/module for extracting plain text from HTML strings? 15:06
lizmat Anton Antonov: (run lynx $url, :out, :!err).out.slurp ? 16:15
ugexe .slurp(:close) 16:26
moon-child I used HTTP::UserAgent 16:36
seems to work pretty well
ugexe that wouldn't strip the html tags would it? 16:37
moon-child OH
I misread the original request
and I misread lynx as curl
>_<
should say misinterpreted, I guess 16:38
ugexe i'd think libxml would work
moon-child yeah I've used XML::Text and gumbo, both worked fine, but that's a lot more work (and more error-prone) than shelling out ot an actual web browser 16:39
(note: iirc gumbo is supposed to be fast, but for what I used it it was somewhat slower than XML::text; maybe conv overhead idk) 16:40
Anton Antonov Thank you all for the suggestions! 16:43
@lizmat I did not have `lynx` ; I installed it. Had to fiddle with certificates settings. The command that worked is this `run('/usr/local/bin/lynx', '-dump', $url, :out, :!err).out.slurp(:close)` 17:10
@moon-child I was thinking to use XML::<Something> libraries, but I spent too much time with `lynx` and it worked, so some another time... 17:12
How can find who contributed Raku code to rosettacode.org/ ? And more specifically the Raku code for Finite State Machines : rosettacode.org/wiki/Finite_state_machine#Raku . 17:43
(I would like to give proper reference / credit in my packages and talks...)
lizmat Anton Antonov: rosettacode.org/mw/index.php?title...on=history 18:12
will be messy, would have to go by commit messages :-( 18:13
Anton Antonov Ah -- good reason to postpone it indefinitely... 🙂 I was also kind of hoping that some here would proclaim authorship. 18:43
MasterDuke i think thundergnat has done a bunch 19:48
guifa lizmat later today you're FINALLY going to see my took-way-longer-than-it-should-have new release of DateTime::Timezones :-) 19:57
hopefully it will work well for the logger
lizmat hopes so too :-) 19:58
guifa is really secretly just hoping lizmat will bug test it for him haha
lizmat I might :-)
guifa The good thing is that I finally really understand how the tz codebase works, so you could also have methods like "DateTime.next-dst-change" and "DateTime.last-dst-change" (that's the only one that comes to mind, but i'm sure I could think of other stuff down the road) 20:01
Anton Antonov @MasterDuke Ok, thanks!
MasterDuke i'm pretty sure i would use DateTime.ante-penultimate-dst-change on a daily basis 20:02
is the same one guy still maintaining the tz database? 20:04
m_athias MasterDuke: he is. 20:23
MasterDuke wow 20:25
japhb Olson? 20:40
That's ... dedication.
m_athias IIRC olson wrote the code and eggert maintained the data. there was some podcast about it some time ago but I didn't manage to dig it out. 20:55
Curiosa Would it be possible to write an assembler in Raku that takes as input some text and outputs Blobs, then use Nativecall to invoke those Blobs as native functions? 23:09
moon-child Curiosa: you would need to use mmap
I have a demo, one sec lemme see if I can find it
Curiosa: ix.io/2W7Q/perl6
Curiosa That’s great! 23:10
Well, one would need to write an assembler around that 23:14
moon-child yeah 23:16
but this is the 'invoke those blobs as native functions' part
Curiosa One could start with a primitive assembler like the one in this video: m.youtube.com/watch?v=Z73eKb2-YrU&t=30 23:17
Of course for x64 it’s more difficult
guifa MasterDuke japhb m_athias Olson wrote the initial code, etc, but now it's handled by IANA who has a process set up for updates 23:34
Curiosa Let’s say one want to write a miniassembler like the one in video. Is there a way from Nativecall to get the symbol tables? 23:39
moon-child Curiosa: what do symbol tables have to do with an assembler? What are you tryihng to do? 23:42
Curiosa Just tell ant to mess around 23:45
He symbol table is useful 23:46
Because on the 6502 you knew where all the important values and procedure were located in the rom
In a modern OS it’s all dynamically randomized 23:47
So you need to find them
moon-child Sure. So: grab function symbol, nativecast to pointer, nativecast to size_t, copy it into your buffer
Curiosa that works 23:48
You could also pass it as an argument to the function 23:49