🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
tbrowder__ data frame sounds like common Raku implementions of CSV files and sql tables 00:08
antononcube I would say that those correspond to Raku datasets, which are row oriented (e.g. a Positional of Maps). Data frames are column oriented, can be seen as transposed datasets, (e.g. a Map of Positionals.) 00:30
tbrowder__ well, look at raku vesions for both csv and sql implementations and one can look at rows or colums as hash or arrays 00:49
antononcube Yeah, sure. My point is that data frames are less natural to integrate with Raku, than datasets. For example, "Text::CSV" produces datasets. (At least by default.) 01:32
guifa_ grr 02:07
m: my token foo { .* }; say 'abc' ~~ /<foo>/ 02:08
camelia 「abc」
foo => 「abc」
guifa_ m: my method foo { self.orig.match: /.*/ }; say 'abc' ~~ /<foo>/ 02:09
camelia No such method 'foo' for invocant of type 'Match'
in block <unit> at <tmp> line 1
guifa_ m: my sub bar { /.*/ }; my token foo { <{bar}> }; say 'abc' ~~ /<foo>/ 02:10
camelia 「abc」
foo => 「abc」
guifa_ m: my sub bar (\self) { say self; /.*/ }; my token foo { <{bar self}> }; say 'abc' ~~ /<foo>/ 02:12
camelia ===SORRY!=== Error while compiling <tmp>
'self' used where no object is available
at <tmp>:1
------> my sub bar (\self) { say ⏏self; /.*/ }; my token foo { <{bar self}
expecting any of:
argument list
term
guifa_ ^^ that feels like an error, if someone defines the var self, there is a self 02:13
golfed 02:18
m: my \self = 42; say self
camelia ===SORRY!=== Error while compiling <tmp>
'self' used where no object is available
at <tmp>:1
------> my \self = 42; say ⏏self
expecting any of:
argument list
term
nemokosch this seems familiar somehow 04:07
amano . 05:28
tbrowder__ antononcube: i'm glad you're on the raku bandwagon! 10:51
which of the raku sql packages do you use? 11:05
antononcube Thanks! 13:09
I never succeeded installing any of the dedicated Raku database packages. I am trying to generate SQL code with my data wrangling DSL package. Recently, instead programming the generation “from scratch”, I switched to using “SQL::Builder” to do the generation. (I have not finished that yet.) 13:13
guifa antononcube: you'll be happy to know I'm currently reworking Intl::Token::Number 13:21
Not going to promise it, but I think today I'll have it done 13:22
leont antoncube: you may also find SQL::Abstract interesting 13:29
antononcube @guifa Good news! 🙂 I don't care if takes you the whole long weekend... 14:06
@leont I think at some point I looked at / in "SQL::Abstract" -- will do that again today.
@leont Hmm... It seems that in "SQL::Abstract" the operations are too "packed", meaning, they combine functionalities. Not a criticism, BTW, just an observation -- in some sense SQL's idea of constructing expressions forces package designers to take that approach. 14:16
To some extend that is why I consider (started) using "SQL::Builder" -- it provides a sequential query building interface that is very close to the monadic workflow I use "DSL::English::DataQueryWorkflows". 14:18
Basically, the author @avuserow has done the "heavy lifting" for me already. 14:19
avuserow Btw, I can't remember where I left off on that module. If you have any questions or PRs, send me a ping and I'll try to answer 14:23
leont I think I get what you mean with packed, but internally it's the only thing that makes sense really given how SQL works. 14:42
leont I have needed such a wrapper at least once though, so maybe I should write it 14:44
antononcube @leont In principle, I can make DSL translators to or via different SQL packages. The select statement in "SQL::Abstract" is the very similar to Mathematica's GroubBy , which I target / use in my DSL translations. 14:53
guifa God bless dwarring 20:41
I just had to scan a ton of two sided docs with a single sided scanner
with PDF::Lite, in only a dozen lines of code (that could totally be golfed into like three), I managed to write a script to completely rearrange the pages so I can just scan front side from page 1 .. N, and then turn around and do back side N to 1, run the script and boom 20:42
antononcube @guifa I am not sure how this PDF scanning helps you write "Intl::Token::Number", but I guess after working with "Brainfuck" grammars you might be prone of doing things in some peculiar ways. 21:22
@guifa (Maybe the trip to Canada also contributed to this...)
guifa_ antonon: I've pretty much got Intl::Token::Number working now 21:34
trying to workout a kink with exponents because for some reason they're not recognized unless there's a space
but my grammar doesn't require it
oh oops I guess I did lol 21:35
forgot a ? quantified 21:36
guifa_ hmmm 21:45
failed a few tests from old version
antononcube Great! 21:46
guifa_ antononcube: should a bar decimal (no fractional digits) be caught? I seem to have done it one way in the old one and the other in the new one
e.g. "There are 57. kg of apples, for oranges, 89." should the numbers be captured as "57." and "89." or "57" and "89"? 21:47
I can think of reasons for both ways
you're the math guy so I'll defer to you
antononcube In this case I thinking more in terms of how to parse output from LLMs and make "operational" in a Raku session. 21:50
librasteve m: say 2 + 3/5i; 21:51
Raku eval 2-0.6i
librasteve ^ this is a bug, right?
antononcube From that perspective this is more desirable: "You have to eat 1. kg apples per month." --> ["You have to eat", 1, "kg per month"] . 21:52
Meaning, Raku should be able to convert those string into numbers. 21:53
guifa_ okay, so you would like it to slurp up a terminal decimal 21:54
when you have the $<local-number> match, it will numbify to the value, and I provide a Role you can test for too if you've got a collection of Match
librasteve are you dealing with commas? if so then I agree that slurp a terminal decimal is good
nemokosch 3 is divided by 5i, I think it's correct 21:55
guifa_ librasteve: yeah, it will detect "1,234" as 1234
tellable6 guifa_, I'll pass your message to librasteve
nemokosch 1/i is equal to -i
librasteve oh - I see
antononcube @guifa Yes, sounds good.
guifa_ alright, lemme reformulate the grammar a bit then I'll release
librasteve m: say 4 + (3/5)i 21:56
Raku eval 4+0.6i
antononcube @librasteve Very often LLMs produce numeric results with commas. That is the reason I looked into "Intl::Token::Number" (and made urgent demands to @guifa.) 21:57
librasteve that's cool - I am thinking of using for next version of Physics::Measure ...
so 6. and 6, are both covered (ie comma as decimal marker)?? 21:58
guifa_ librasteve: depends on the language
tellable6 guifa_, I'll pass your message to librasteve
librasteve okaay - I look forward to raod testing! 21:59
guifa_ for English, if you had "There are 54, dogs, 65. cats, 89 things', the comma won't be consumed by the number token, but the period would
antononcube Right! 22:02
guifa_ antononcube: is uploaded! 22:21
antononcube Interesting -- it is conjugated by default.
@guifa Ok, will experiment with it tonight. 22:22