🦋 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.
00:25 jpn joined, Chanakan joined 00:30 jpn left 01:08 hulk joined 01:10 kylese left 02:04 jpn joined 02:09 jpn left 02:11 jpn joined 02:15 hulk left, kylese joined 02:17 jpn left 02:47 teatime joined 03:13 jpn joined 03:17 jpn left 03:56 raiph left 04:04 merp left 04:08 merp joined 04:13 soverysour joined, soverysour left, soverysour joined 04:14 jpn joined 04:17 soverysour left 04:20 jpn left 04:51 jpn joined 04:56 jpn left
xinming pastebin.com/0tjH8CL0 <--- Why can't we add role to an anonymous class please? 05:29
05:30 Sgeo_ left
xinming hmm, I mean, add roles dynamically to anon classes. 05:33
05:34 teatime left
xinming We can see the roles are in the class already, But role methods doesn't seem to be called. 05:34
05:47 teatime joined, jpn joined
Voldenet no need for composition in that example 05:50
m: role RA { method t { callsame; "RA".say; }} 05:51
camelia ( no output )
Voldenet m: role RA { method t { callsame; "RA".say; }}; my $c = class :: does RA { method t () { "c".say; } }; $c.new.t
camelia c
Voldenet the above is equivalent
and role method is not called too 05:52
consider this 05:53
m: role RA { method t { callsame; "RA".say; }}; my $c = class :: { method t () { "c".say; } } but RA; $c.new.t
camelia c
RA
xinming Voldenet: But how do we programmically do this? 05:54
05:54 jpn left
xinming I mean, do "but" dynamically. 05:54
Voldenet well
m: role RA { method t { callsame; "RA".say; }}; my $c = anon class :: { method t () { "c".say; } }; for RA { $c = $c but RA }; $c.new.t 05:55
camelia c
RA
Voldenet m: role RA { method t { callsame; "RA".say; }}; my $c = anon class :: { method t () { "c".say; } }; for RA { $c = $c but $_ }; $c.new.t
camelia Cannot mix in non-composable type RA into object of type <anon|1>
in block <unit> at <tmp> line 1
xinming and I also don't understand why class :: does RA version doesn't work either.
Voldenet Hm.
xinming IIRC, we need to bind it to a constant
m: role RA { method t { callsame; "RA".say; }}; my constant C = anon class :: { method t () { "c".say; } }; for RA { $c = $c but $_ }; C.new.t
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$c' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> { method t () { "c".say; } }; for RA { ⏏$c = $c but $_ }; C.n…
xinming m: role RA { method t { callsame; "RA".say; }}; my constant C = anon class :: does RA { method t () { "c".say; } }; C.new.t 05:56
camelia c
Voldenet I think in the `does` (^add_role) case RA has default impl for t 05:57
I could be wrong though
m: role RA { method t { callsame; "RA".say; }}; my $c = anon class :: { method t () { "c".say; } }; for [RA] { $c = $c but $_ }; $c.new.t 05:59
camelia c
RA
xinming Voldenet: the but version worked perfectly. 06:00
Voldenet nice
I do wonder what happens in `for RA { $c = $c but $_ }` 06:02
xinming pastebin.com/TEGybbVt <--- This version worked, Now, What I can guess is, probably, "but" is applied dynamically to a variable, Where does compiles things statically, So they need to .^compose
So class with .^compose has better performance as it's compile time. 06:03
the "but" does all things dynamically, This is what I guess
Voldenet no doubt, in `but` case there's wrapper over wrapper
m: role RA { method t { callsame; "RA".say; }}; my $c = anon class :: { method t () { "c".say; } }; for RA, RA { $c = $c but $_ }; $c.new.t
camelia c
RA
RA
xinming and that's why $c.^compose doesn't work, since .^compose do things on static things.
Voldenet but as demonstrated earlier, if you do `does`, RA.t doesn't get called as well 06:04
m: role RA { method t { callsame; "RA".say; }}; my $c = class :: does RA { method t () { "c".say; } }; $c.new.t
camelia c
Voldenet in fact 06:05
m: role RA { method tx { callsame; "RA".say; }}; my $c = class :: does RA { method t () { "c".say; } }; $c.new.tx
camelia RA
Voldenet So anon|1.t is shadowing the RA.t
xinming So probably a bug?
it feels like a bug
if ".tx" method is not found, in your last example, I'd feel it's a feature. 06:06
Now It's more confusing
Voldenet it's a bug if `RA.t` should be default implementation 06:07
ngl, I use `does + role` with `method t { … }` 06:08
erm, it's a bug if `RA.t` shouldn't be the default 06:09
xinming Need someone to confirm this. :-) 06:14
Voldenet m: role RA { method t { callsame; "RA".say; }}; my $c = anon class :: { method t () { "c".say; } }; for RA, RA { $c = $c.new does $_ }; $c.new.t
camelia c
RA
RA
Voldenet I'm fairly sure it's different syntax for the same thing 06:15
this behaviour with default impl being overriden is expected: docs.raku.org/language/objects#Pecking_order 06:22
m: role RA { multi method t { callsame; "RA".say; }}; my $c = class :: { multi method t () { "c".say; } }; $c.^add_role(RA); $c.^compose; $c.new.t 06:24
camelia Ambiguous call to 't(<anon|1>: )'; these signatures all match:
(<anon|1> $:: *%_)
(<anon|1> $:: *%_)
in block <unit> at <tmp> line 1
xinming Voldenet: Yea, I just realized, `class A does R { method here has higher priority. }` and now, I got more confused, how can a role do around modifier just like "Moose" does 06:28
Voldenet behold 06:29
role RA { method t () { callsame(); "RA".say; }}; my $c = class :: { method t() { "c".say }}; my $d = Metamodel::ClassHOW.new_type(name => 'd'); $d.^add_parent($c); $d.^add_role(RA); $d.^compose; $d.new.t; 06:30
evalable6 c
RA
Voldenet it makes sense if you look at the docs
and lose your sanity on the way
it's different than the previous example 06:33
m: role RA { method t () { callsame(); "RA".say; }}; my $c = class :: { method t() { "c".say }}; my $d = Metamodel::ClassHOW.new_type(name => 'd'); $d.^add_parent($c); for RA, RA { $d.^add_role($_); }; $d.^compose; $d.new.t;
camelia c
RA
Voldenet because role is only added once
hmm 06:37
m: role RA { method t () { callsame(); "RA".say; }}; my $c = class :: { method t() { "c".say }}; my $d = $c.HOW.new_type(name => 'd'); $d.^add_parent($c); for RA, RA { $d.^add_role($_); }; say $d.^roles; $d.^compose; $d.new.t;
camelia ()
c
RA
Voldenet m: role RA { method t () { callsame(); "RA".say; }}; my $c = class :: { method t() { "c".say }}; my $d = $c.HOW.new_type(name => 'd'); $d.^add_parent($c); for RA, RA { $d.^add_role($_); }; $d.^compose; say $d.^roles; $d.new.t;
camelia ((RA) (RA))
c
RA
Voldenet …so the role is actually added multiple times, but dispatch somehow understands this 06:38
06:58 soverysour joined, soverysour left, soverysour joined 07:03 soverysour left
lizmat Voldenet: yes, the MOP has checks for that 07:25
07:26 wayland76 joined 07:28 wayland76 left 07:29 wayland76 joined 08:08 soverysour joined, soverysour left, soverysour joined 08:16 soverysour left 08:40 jpn joined 08:51 sena_kun joined 09:06 sena_kun left 10:31 soverysour joined, soverysour left, soverysour joined 11:30 Geth left, Geth joined 11:37 lizmat_ joined 11:40 melezhik joined
melezhik o/ 11:40
11:41 lizmat left
ab5tract Hey hey 11:42
11:42 lizmat_ left, lizmat joined
melezhik started to write yet another post on how to replace ansible with Sparky - comments are welcome, this is a draft - dev.to/melezhik/sparky-simple-and-...15ac0601a0 11:43
ab5tract - hi )
dev.to/melezhik/sparky-simple-and-...ug-3782232 - better link 11:45
ups - this does not work, I guess the first one should be fine
ab5tract Looks good so far! Might be worth a round of editing by a native English speaker, as there are a few phrasing’s that could be touched up 11:51
11:51 xinming left
ab5tract Maybe even an AI would be useful for that 11:51
Unfortunately I’m about to board a plane so I can’t help with that :( 11:52
11:52 melezhik left 12:00 melezhik joined
melezhik ab5tract - sure, gramma / stylistic correction are welcome, I have been lazy with gramma in this post ))) 12:00
that's ok ) 12:01
lizmat
.oO( never speak back to your grandparents! )
12:02
12:09 melezhik left 12:14 jpn left 12:30 xinming joined 12:43 xinming left, xinming joined
antononcube @ab5stract Yeah, there is an LLM prompt for that: resources.wolframcloud.com/PromptR...s/CopyEdit 12:45
That prompt is also available in “LLM:Prompts”. I think, I started a demo about automatic editing of Raku documentation, but I posted results or teasers only here. (In IRC.) 12:46
12:48 merp left 12:55 jpn joined 12:59 avuserow_ left 13:00 MasterDuke joined, avuserow_ joined, soverysour left 13:01 jpn left 13:02 xinming left 13:04 xinming joined 13:14 melezhik joined
melezhik lizmat I menat grammaR ) 13:15
meant
a lot of typos , sigh, today
13:22 melezhik left 13:24 melezhik joined
melezhik . 13:24
weekly: dev.to/melezhik/sparky-simple-and-...sible-1fod 13:31
notable6 melezhik, Noted! (weekly)
[Coke] I mentioned the airport yesterday - ended up going to 8 different gates for this flight across 4 different terminals (airport so big you had to take the elevated tram to get between terminals). this plus all the little delays (adding up to a few hours) made for some... excitement. 13:40
Thankfully, at least, it wasn't a drunkard's walk, all the terminals we visited? Just once. :)
13:42 jgaz joined
antononcube @Coke Extraordinary claims require extraodinary evidence. (I.e. you think you visited all terminals and you think it was just once.) 13:43
13:43 jpn joined
This reminds me -- there should be a graphs package in Raku's ecosystem. To solve Hamiltonian and Eulerian path problems and similar... 13:45
[Coke] I don't remember all the gates, but it was Terminals C, D, A, B in that order. we skipped E. 13:47
I get app updates, not text messages, so i can't easily see the history to mine the data. :) 13:48
(I am so tired. :)
13:49 soverysour joined, melezhik left
antononcube @Coke 🙂 This story reminds of Peter Falk's Emmy's award (1972): www.youtube.com/watch?v=Q8TUSsqWCTM 13:51
El_Che lizmat: rakudo-pkg 2024.05 is out (and the missing releases added) 13:52
tellable6 2024-05-30T20:30:31Z #raku-dev <jdv> El_Che the may release happened
El_Che jdv: released rakudo-pkg thx
jdv El_Che: nice, thanks! 13:55
[Coke]: was it because of power issues? 13:56
14:06 teatime left 14:07 teatime joined
[Coke] I think it was all weather adjacent, and once a big enough # of flights are impacted, there's ongoing issues for a while as things try to catch up 14:19
The gate changes were probably just adjustments based on other flights who were stealing our gates. :) 14:20
The airport itself was fine, and when we finally left, there was no bad weather or turbulence.
teatime will no one rid me of this turbulent priest
[Coke] wonders if teatime is commenting on my airport fun or not with his Henry II quote. 14:23
antononcube @Coke & @teatime 🤔 14:27
@Coke To be honest, staying and wandering in airports for that long can make one pretty indifferent to bad weather and turbulence while flying. 14:30
teatime coke, I had once again mistaken this channel for one of my idle social chatter channels. I beg your forgiveness. 14:35
[Coke] antononcube - Fair, I was so happy to get on the plane at that point. 14:36
teatime "as long as we're moving, I don't even care if it's 50 feet suddenly straight down" 14:37
14:39 soverysour left 14:52 jpn left 14:56 jpn joined 15:00 soverysour joined, soverysour left, soverysour joined
antononcube And it is raccoons all the way down! 15:09
As I threatened, I made and published the package "Algorithm::KDimensionalTree", raku.land/zef:antononcube/Algorith...sionalTree . I hope it is not too confusing to have both "Algorithm::KdTree" and "Algorithm::KDimensionalTree". 15:11
[Coke] I definitely recommend the movie "Raccoons all the way down" on MAX, quite good. 15:12
antononcube 🙂 Also, maybe, "Mad Max -- the raccoons return", etc. 15:14
15:36 jpn left 15:42 jpn joined 15:51 jpn left
tbrowder um, what airport caused all the fun? 16:24
check out tom hanks in "the terminal" for airport fun 16:25
_grenzo My guess from his description of Tram, Terminals, and weather...DFW 16:28
[Coke] tbrowder: DFW 16:35
grenzo++
16:40 wayland76 left, wayland76 joined 16:44 Sgeo joined 17:00 heartbur1 left 17:48 soverysour left 18:30 jpn joined 18:35 jpn left 18:38 Sunil joined 18:43 Sunil left 18:47 soverysour joined, soverysour left, soverysour joined
SmokeMachine m: say &[&] =:= [ && ].head 19:05
camelia False
SmokeMachine m: say &[&]
camelia &infix:<&>
SmokeMachine m: say [ && ].head 19:06
camelia (Callable)
SmokeMachine m: “[ && ]”.AST 19:07
camelia ( no output )
SmokeMachine m: say “[ && ]”.AST
camelia RakuAST::StatementList.new(
RakuAST::Statement::Expression.new(
expression => RakuAST::Circumfix::ArrayComposer.new(
RakuAST::SemiList.new(
RakuAST::Statement::Expression.new(
expression => RakuAST::Contextualiz
19:21 jpn joined 19:28 soverysour left, soverysour joined, soverysour left, soverysour joined 19:29 jpn left 19:42 soverysour left 19:59 jpn joined 20:18 jpn left 20:53 sena_kun joined
wayland76 melezhnik: Sparky looks good, but when can we replace dockerfiles/docker-compose with raku? :p 21:02
(This is coming from someone who preferred Puppet over Ansible) 21:03
...and manage Kubernetes clusters with it? 21:04
antononcube ... Using grammar-and-LLM based interpreters. 21:11
wayland76 Incidentally, I'm attempting to build a general-purpose declarative Slang for Raku 21:27
(Inspiration sources include Prolog, Raku Grammars (grammars are declarative), XSLT, Puppet, Makefiles, and SQL) 21:29
antononcube @wayland76 I have built domain-specific-purpose interpreters for Python, R, Raku, and WL. The domains are Machine Learning and Data Wrangling. 21:44
I think something similar can be done preparing utilization of LLMs/
I am not sure can we call those DSLs declarative. In some sense they are, but right now are on the prescriptive side. The methodology, though, allows for declarative extensions. 21:46
One of the more robust ways to utilize LLMs is through the "declarative mindset." 21:47
wayland76 Right. As step 1, I'm essentially trying to add predicates/rules to Raku. 21:49
(From Prolog)
antononcube Can you use LLMs to interpret Prolog into Raku? 21:50
wayland76 Haha, I'm not trying anything quite that complicated yet.
Step one of adding predicates/rules is to override the multiple dispatch so it calls all the rules instead of just the first :) 21:51
But I wouldn't say I really know Prolog properly either -- I'm just trying to nick ideas from it. 21:52
(well, Prolog, Gödel, and Alma-0)
antononcube Frequents(drinker, bar) Likes(drinker, beer) Sells(bar, beer, price) 21:53
Happy(d) <- Frequents(d,bar) AND Likes(d,beer) AND Sells(bar,beer,p) 21:54
wayland76 Yeah, joins are going to be a later step.
antononcube Is your slang going to handle those specs?
wayland76 Is anyone able to explain why the code in gist.github.com/wayland/cdf69e8b52...397ad72df3 adds the parameters in the array to signature3 in an array, but when I try to flatten them in signature2, they all just disappear? 21:55
antononcube I think at some point -- 25+ years ago -- I decided that Prolog is "useless", and if I am forced to use that paradigm I will use Datalog. 21:56
wayland76 antoncube, not that particular syntax, but something pretty close is what I'm aiming for.
antononcube Right. More or less that is why I use DSLs that are natural-language-based. Less syntax slavery... 21:57
Hmm... Datalog translation to Raku might be worthy effort. 21:58
wayland76 I'm wanting to build a generalised model that will be useful for any declarative language, but I doubt I know enough about Logic Programming to do a good job. So I'm going to hack some pieces together, then seek feedback. 22:00
antononcube Aha. That is why I am suggesting LLM utilization. It might help in those efforts. 22:01
wayland76 I hear you about natural-language based programming languages -- I've also been thinking about a language that has eg. verbs instead of functions, and nouns instead of classes.
antononcube My approach to data wrangling specs translation to different languages is shown thin this (3 min long) movie: www.youtube.com/watch?v=OHY64ezgnm4 22:04
At that point -- 2020 -- Raku was not present. Not it is. 22:05
wayland76 Closest I've come is I asked ChatGPT to interact with a Google/YouTube API, and it kept trying to use a library that's only available in Perl.
antononcube Yeah, you might have old (cheap) model.
Latest OpenAI LLM models know Raku pretty well. (Still there are errors.) 22:06
LLM performances for Raku code depend on the domain, a lot. 22:07
wayland76 Yeah, this was like a year ago, and was the free model. 22:10
Glad to hear it's improved on the Raku front :) 22:11
antononcube Yeah, to a point. I think two years ago I decided to use Raku "just" for prediction code generation and make Raku prediction-capable itself. 22:13
This basically required making Raku more applicaple to data wrangling.
I.e. facilitating data wrangling. 22:14
And least some basic Machine Learning (ML) algorithms.
wayland76 Yeah, I'd like Raku to better suit Table-Oriented Programming, Tree-oriented programming, and Array-oriented programming 22:16
(which would help with data wrangling I think)
And also have dataflow design tools (a bit like node-red/n8n)
(Tree-oriented programming isn't a thing really -- the closest I've seen are some of the XML things like XPath for manipulating trees) 22:17
22:19 sena_kun left
antononcube The function Cases in Mathemaica is similar XPath and more powerful. 22:20
Not because of Cases per se, but because of the pattern matching in Mathematica.
wayland76 Sounds good. I've been interested in Mathematica/Wolfram since seeing that they ranked highest on the list of multi-paradigm languages, but I don't have access to it. 22:24
Though I've never actually checked if they had a free version 22:25
antononcube Wolfram Engine is free for developer -- you have to register with an email. 22:26
You can have notebook interface to WE with 1) Jupyter or 2) WLJS .
wayland76 OK. I should check that out at some point. Thanks!
antononcube The latter is actively developed -- I think it should be highjacked to make it work with Raku. 22:27
23:13 kjp left 23:42 soverysour joined 23:47 soverysour left