🦋 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 yo, my early Christmas present was using @jnthn's module 'OO::Monitors' which solved my thread problem which was locking up my multicore computer. 01:11
thnx lizmat for putting it in zef with community modules 01:12
lizmat weekly: raku-advent.blog/2024/12/06/day-19...i-capsule/ 09:06
notable6 lizmat, Noted! (weekly)
antononcube weekly: rakuforprediction.wordpress.com/20...aku-set-2/ 17:22
notable6 antononcube, Noted! (weekly)
roguerakudev I was wondering if anyone has a pointer to documentation or a starting point for reading the code related to "repossession" in Rakudo 18:27
re. this issue comment: github.com/rakudo/rakudo/issues/56...2437094425
niner identified the general area of the issue, but it seems like no one picked up the fix so I was hoping to do it myself, but I have done very little poking through rakudo so far 18:28
lizmat rakking through MoarVM and NQP code, there's quite a few references to them in comments, but no actual documentation :-( 18:34
antononcube @lizmat Thanks for posting my post on Reddit! 18:35
lizmat yw :-)
ab5tract roguerakudev: scratching a personal itch is a great way to get started on hacking Rakudo! 18:50
However, that specific issue is likely to be fairly intricate and thorny 18:51
It may be worth it to scan the open issues for something else that suits your taste to serve as a starter issue 18:52
But of course jumping into the deep end also has its merits!
roguerakudev I'm assuming it's best to work on the RakuAST branch these days, assuming it's an actual Rakudo issue rather than Moar 18:54
or is that not a separate branch now 18:55
I'm open to recommendations on a "starter issue" if anyone has itches 19:00
lizmat roguerakudev RakuAST is now in main, activate by running with RAKUDO_RAKUAST=1 19:39
[Coke] I have a grammar that has a JUNK regex that is a single . - all other regex are interesting, and longer than a single character. if I have a TOP that is ( <THING> | <OTHER> | <JUNK>)*} - shouldn't the JUNK only match if nothing else does at that point? running it through the debugger, it seems to be preferring the JUNK rule, even when it could match a longer item at that point 19:40
ugexe m: grammar Foo { token TOP { (<thing> | <junk>)* }; token thing { "aa" }; token junk { . }; }; my $g = Foo.new; my $m = $g.parse("aa"); say $m 20:00
camelia 「aa」
0 => 「aa」
thing => 「aa」
ugexe that example does not choose JUNK
[Coke] yes. for simple examples works fine. for my example, it's skipping most of the content in favor of junk 20:01
I'm trying to golf.
Looks like a nested rule is part of the issue. 20:08
roguerakudev interesting, there is seemingly a regression on rakudo:main since release 2024.09 related to exporting enums? 20:09
consider Logging/Level.rakumod with use v6.d; unit enum Logging::Level is export < DBG INF WRN ERR FTL >; 20:10
then use Logging::Level; sub foo(Logging::Level $level) { say $level } 20:11
this works as expected on release but on latest main it gives Invalid typename 'Logging::Level' in parameter declaration 20:12
even though make spectest passes completely
works fine if you do Level instead of the FQN
lizmat could you golf that into an issue ? 20:13
[Coke] m: grammar A { regex N { \d ** 1..3 }; regex FOO { 'foo(' <N> ',' <N> ')' }; regex JUNK { . }; regex TOP { (<FOO> | <JUNK>)+ } }; say A.parse("foo(371,776)");
camelia 「foo(371,776)」
0 => 「f」
JUNK => 「f」
0 => 「o」
JUNK => 「o」
0 => 「o」
JUNK => 「o」
0 => 「(」
JUNK => 「(」
0 => 「3」
JUNK => 「3」
0 => 「7」
JUNK => 「7」
0 => 「1」…
roguerakudev yep, can do
ugexe changing to `regex N { \d+ }` appears to get the desired results, so maybe related to that \d ** 1..3 20:16
[Coke] or \d | \d\d | \d\d\d 20:27
ugexe++ 20:28
roguerakudev As I'm golfing this it's getting stranger and stranger
it only happens when my CWD is the root of the rakudo project lol 20:31
it's not ideal for sure, but highly unlikely to be an issue for 99% of users 20:34
aruniecrisps i made an issue on Definitely: github.com/masukomi/Definitely/issues/4 20:37
i'm curious as to what monad syntax could look like in Raku
[Coke] do you have a RAKULIB set, perhaps? 20:38
Geth advent/main: cd28b53d65 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | raku-advent-2024/authors.md
23 -> 10, 10 -> 19
20:39
aruniecrisps @librasteve thoughts? 20:42
librasteve lemme see 20:44
tx!
so, tbh I am not sure that that module (which is very small and very opinionated) is a good place to have a discussion about "better ways to do Monad in Raku" 20:52
[Coke] opens github.com/rakudo/rakudo/issues/5722 20:55
librasteve raku core support for "Monad" is return type smileys sub fn() returns Int:D {} so matsukomi module is a small rebellion that leans on raku is a self modifying language idea - but it is not really a robust idea more a template for if you really wanna do Monads that you can warp raku that way 20:56
roguerakudev [Coke] no RAKULIB set
[Coke] ok. (a relative dir in there might explain behavior changing in different dirs0 20:57
aruniecrisps @librasteve i'll get rid of the issue then 21:25
oh nvm you closed it
librasteve sorry - I'm right on the edge of my knowledge with Monads so not really able to understand your main idea / proposal 21:30
aruniecrisps how familiar are you with the concept of do-notation? 21:31
librasteve never heard of it
(my bad) 21:32
aruniecrisps So Haskell, F#, Scala, Ocaml and a lot of these functional languages have syntax that is meant to replicate a procedural style of coding, but underneath the hood it desugars to a bunch of bind calls
so in Haskell if i were to write something like this: haskell result :: Maybe Int result = do x <- Just 2 y <- Just 0 Just $ x + y this ultimately desugars to 2 >>= \x -> (3 >>= \y -> Just x + y)), where the <- basically desugars to a bind call 21:35
this gets way more useful when you're dealing with types like Either/Result, Async, etc 21:36
this pattern is so useful that JS/TS, Python, and Rust have it baked into the language specifically for asynchronous programming, ans JS also has it for generators 21:37
the idea behind having such a syntax is that it's applicable in many different places 21:39
I feel I could try and write a Slang for this to see how it would work
librasteve serokell.io/blog/haskell-to-core << just had a look at this - there is much for me to learn 21:41
appreciate the general idea - I think it is interesting to see how raku can be "warped / slanged" to be (even?) more amenable to functional needs - you are welcome to fork Definitely or to make something from a new angle... 21:46
must sleep 21:51
aruniecrisps i'll do some investigation 21:55
thanks!
guifa even though it feels weird to use .kv on lists, man it's useful to do $text.lines.kv -> $line-no, $text { ... } 23:00
antononcube Well, either .kv or a special function / method to do map with indexing, e.g. map-indexed. 23:10
BTW, Mathematica has MapIndexed : reference.wolfram.com/language/ref...ed.html.en 23:25