🦋 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.
SmokeMachine usercontent.irccloud-cdn.com/file/.../image.png 10:22
SmokeMachine I think it is starting to look good... 10:35
nahita3882 wow that looks cool, last time I tried to insert a binding statement immediately after a for loop's block starts, I wrote a Slang with NQP/QAST stuff and error messages weren't encouraging on the way 10:47
I wonder if this works/can work on broken code, e.g., I have f().say, as a string, and I would like to detect if the last thing in this expression is a call to "say", or not 10:48
but &f is unknown to the compiler, that's problematic? 10:49
SmokeMachine nahita3882: usercontent.irccloud-cdn.com/file/.../image.png 11:10
nahita3882 i see... do you imagine any workaround for this 11:16
Python's standard ast module doesn't evaluate so it doesn't complain about undefined names, e.g., import ast; print(ast.parse("f()").body[0].value.func.id) prints "f" 11:18
SmokeMachine I don’t know… :( 11:22
But I don’t think that’s related to evaluation, but in a way to know if that’s a func or a term… 11:25
But using () it maybe could assume that’s a func?!
That maybe would work with a method… 11:26
usercontent.irccloud-cdn.com/file/.../image.png 11:27
if you wand the parent node: usercontent.irccloud-cdn.com/file/.../image.png 11:28
or: usercontent.irccloud-cdn.com/file/.../image.png 11:30
SmokeMachine (I need an `.node` group to be used instead of RakuAST::Node but it would also include RakuAST not children of RakuAST::Node... 11:33
lizmat m: use v6.*; dd .^name for RakuAST::Node.^mro 11:38
camelia "RakuAST::Node"
"Any"
"Mu"
lizmat RakuAST::Node does *not* inherit from RakuAST
SmokeMachine yes, I know... I meant *.starts-with: "RakuAST"... 11:39
lizmat: usercontent.irccloud-cdn.com/file/.../image.png 11:40
SmokeMachine Probably not including some of those... (like the HTML) 11:42
nahita3882 thanks SmokeMachine, inexistent method call doesn't yield a compile-time error but undefined function name does, so that's why it fails I believe 12:56
lizmat clickbaits rakudoweekly.blog/2024/10/28/2024-...es-fallen/ 14:02
antononcube @lizmat As you say, my newest video is really nice. Except for 3-4 bloopers... 14:03
lizmat but that's what's really nice about it :-) 14:04
antononcube 🙂 💯
Also, you mentioned "Math::SparseMatrix" twice. (Not a big deal...) 14:05
lizmat that's the correct name, no? 14:11
antononcube Yes, that is the correct name. There is also, "Math::SparseMatrix::Native", but that was last updated 20+ days ago. 14:16
lizmat Aaah... I see what you mean.... fixed now, thanks for the nudge! 14:17
antononcube Is it a good idea to overload + and * for Math::SparseMatrix multiplication? Maybe, those operators are seen as too generic? (They are not exported by default for now.) See code with them here: github.com/antononcube/Raku-Math-S...metic.raku 14:21
Are there any unforeseen side effects by overloading + and * ? For example, slowing down the normal operation on scalars? 14:22
[Coke] remembers he can run the mersenne prime search on this laptop and not notice. 14:31
lizmat if you export them, it should only affect code in that lexical scope 14:38
[Coke] (mersenne prime search) any interest in a raku team? 14:39
antononcube @Coke I am very interested in "Mersenne Twister", and being able to get the same random numbers from it in different Raku sessions. 14:41
@lizmat Yeah, ok.
More generally, is there an easy way to get random number generation reproducible across different sessions? I have asked that before. It is very inconvenient to make math tests without reproducible random numbers sequences. 14:44
I mean, "system level" random generation, for srand, pick, roll, etc. 14:45
lizmat there's an open issue about it
the problem is, is that the same random generator is used for creating hash keys *and* producing random numbers 14:46
and because of spesh, which runs code whenever it wants to / can (which may create hashes and keys), there's no guarantee that you'll be able to get into the sequence of random numbers that the generator generates at the same location 14:48
antononcube perhaps raku.land/zef:raku-community-modul...th::Random is what you need ? 14:49
antononcube Ok. This means using alternative random number generation like "Math::Random". 14:50
lizmat yes, if you want truly repeatable sequences
antononcube @lizmat I was/am just looking into that package.
I will try out that package soon... 14:52
lizmat antononcube should you find issues, PRs are welcome as it is a community module 14:53
lizmat and we always need caretakers for those :-) 14:53
nahita3882 lizmat can you explain what "spesh" is?
lizmat nahita3882 check out 6guts.wordpress.com/2017/08/06/moa...ring-data/ and follow up blog posts 14:55
nahita3882 thank you 14:56
antononcube @lizmat A follow-up question— is it a good idea to overload pick and roll to use “Math::Random” if given a certain adverb? Like, (^100).pick(10):mt. 15:09
librasteve @antononcube - I think that the world will thank you if you can follow the Math::Matrix API (or a subset of it, perhaps with coercers). That overloads + for add scalar only (ie add same rhs to all matrix elems) and * multiply scalar only and . for dot product among a few others. raku.land/github:pierre-vigier/Mat...ply-scalar 17:22
ab5tract antononcube: that sounds reasonable to me. 17:23
ab5tract I might suggest going even more extreme and augmenting the core class methods 17:24
Perhaps based on an import flag (:augment-core) or the like 17:25
antononcube @ab5tract I will consider/try that. 17:27
@librasteve I have used "Math::Matrix", but did know or noticed that it overload the +, * and . . I am surprised about the last one, to be honest, since "dotty infix" is somewhat of a special case and with a certain mind-share. 17:30
And I was also considering dot as an infix operator... 🙂 17:32
@librasteve Actually, after examining "Math::Matrix" README section "Operators" it seems "Math::SparseMatrix" is in agreement with it. (So far.) 17:34
librasteve cool - I would say very handy to have coercers (both ways) too ;-) 18:08
antononcube I prefer those kind of packages to be (very) decoupled. At this point, "Math::SparseMatrix" objects can be turned into "Math::Matrix" objects by using the .Array method. I.e. Math::Matrix.new($smat.Array). 18:43
Should work the other way too. 18:44
Xliff \o 19:17
antononcube (⌐■_■) 19:30
Xliff Anyone have any cool RakuAST examples, yet? 19:32
lizmat github.com/rakudo/rakudo/blob/main...er.rakumod 19:33
lizmat Buddy! media.hachyderm.io/media_attachmen...2e4e97.jpg 19:35
oops ww
librasteve lol 19:40
is our sub another way to say sub blah is export?
oh yeah - opposite of my class {} 19:41
@antononcube ... please envision a world where consumer of your module want to do something with a Matrix ... with a coercer, they can say something like `multi(Math::Matrix() $m) { ... } and that'll be able to take both a random and a sparse regardless ... 19:44
Xliff lizmat: Nice dog...
librasteve dog++ 19:59
antononcube I think “Math::Matrix” is fairly heavy package, which has not been developed lately. I would make an “optional” dependency on it — if it is installed, some of the “Math::SparseMatrix” methods can use it. 20:10
librasteve i agree ... it's too intese for my taste 20:11
intense
antononcube I was considering to implement named rows and columns for “Math::Matrix” — this a way look into that package, but now that is of a much lesser priority. 20:19
How easy it is to automatically create web apps similar to the user interface if of chatgpt.com ? Basically, a few selections have to be done: (i) service provided, (ii) LLM model, (iii) temperature, (iv) prompt, and have a "main panel" for the chat with LLM. 20:44
Ideally, this web apps are created / generated via CLI with minimal setups. For example, just giving a prompt and/or LLM access configuration. 20:46
SmokeMachine .tell Xliff I think this a simple, yet cool example: usercontent.irccloud-cdn.com/file/.../image.png 21:22
tellable6 SmokeMachine, I'll pass your message to Xliff
ab5tract Xliff: all of the greatest hacks I've seen from RakuAST are in the RakuAST implementations. Here's all it takes to implement the `handles` trait: github.com/rakudo/rakudo/blob/76f6...kumod#L298 21:36
tellable6 ab5tract, I'll pass your message to Xliff
ab5tract Xliff: or this new and improved version of FIRST which works in any block (not just routines) and which returns the value of the expression (which < v6.e FIRST does not) 21:48
tellable6 ab5tract, I'll pass your message to Xliff
ab5tract Xliff: github.com/rakudo/rakudo/blob/76f6...kumod#L696
tellable6 ab5tract, I'll pass your message to Xliff