🦋 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.
antononcube I submitted a new package with fez a few hours ago, and I still do not see in raku.land or 360.pm. 03:11
librasteve @antononcube - i normally go zef update & zef install My::Package to double check arrival that works right away - it's the raku.land website that takes a while to reindex the fez repo iirc 07:09
Geth ¦ problem-solving: jubilatious1 assigned to codesections Issue Feature Request: recognize "doubled" Unicode characters in Raku ternary operator (question mark and exclamation point). github.com/Raku/problem-solving/issues/433 09:41
¦ problem-solving: lizmat unassigned from codesections Issue Feature Request: recognize "doubled" Unicode characters in Raku ternary operator (question mark and exclamation point). github.com/Raku/problem-solving/issues/433 09:52
librasteve o/ ... 10:46
m: say "1\t2"
evalable6 1␉2
Raku eval 1 2
librasteve m: say "1 2" 10:47
Raku eval 1 2
evalable6 1 2
librasteve wonders how to set spaces output by \t - on my machine its 8 spaces ;-(
(or maybe I have to explicitly set spaces since this is a property of the users terminal??) 10:48
lizmat yeah, tabs are fun 10:50
FSVO fun :-)
wayland Is there some automatic way to do smart matching on hash keys like maybe -- %hash{~~/^a/} -- for all keys that start with "a"? Or do we have to use map? 11:30
lizmat maybe raku.land/zef:lizmat/Map::Match is a thing for you? 11:33
librasteve wayland: you can have a slice (ie a list of keys) as the index - and that can be provided by a block (may need two levels of curlies will need to check) 11:34
or maybe lizmat already wrote that ! 11:35
lizmat well, for an immutable Map... mutable Hashes are something else
wayland Oh, nice! Thanks to both of you. Now all I need is to be able to go %m<//a>, and it recurses down the tree finding everything with the name "a" :) (like XPath) 11:39
lizmat wayland: perhaps unexpected, but you can probably use raku.land/zef:tony-o/JSON::Path for that 11:41
because it works on hashes (aka what "from-json" produces 11:42
wayland Oh, very nice!
lizmat it's exposed in App::Rak as jp:... 11:43
wayland Sometime in the next couple of years, we're going to need some kind of documentation that says something like "If you're working with hashes (or whatever), then here's a quick writeup of each of the modules you could use.
lizmat would be nice for a blog post now :-) 11:44
wayland That'd be a good starting point, but it'd get buried over time I think. Or maybe not.
.tell antononcube Question: does github.com/antononcube/Raku-DSL-En...yWorkflows work for insert/update as well, or just querying? 12:00
tellable6 wayland, I'll pass your message to antononcube
kylese Greetings. I have 'my-sub A.new.value("Ava");'. The .value method is a combined accessor (getter + setter) always re-setting/returning a string, but not always used directly. The subroutine 'my-sub' is supposed to handle only types of classes A/B/C…. I'm looking for a way to pass the resulting instance of A itself. Like, 'my $a = A.new.value("Ava"); my-sub $a;'. (In this specific case, creating two instances like 'my-sub A.new(A.new.value("Ava")); 12:23
' would also actually work.) Is there any sub/method - maybe similar to .^raku , .^HOW , .^mro etc. - to get the instance of A more directly.. "in a one-liner"? Thx.
lizmat self ? 12:26
kylese lizmat, I tried 'A.new.value("Ava").self' does not work.. 12:31
lizmat aha.. ok. question:what does .value return *exactly* ? 12:32
kylese lizmat, always a string value. In this case "Ava" (by default "none"). 12:34
lizmat then there's no way to get back to the A instance
kylese lizmat, I guess I always need two statements?? 12:35
kylese lizmat, ..at least.. 12:36
lizmat well, I guess you could try to mixin a method returning the instantiated A into the string 12:41
but it feels we need more info on what you're trying to achieve to give a good advice 12:42
kylese lizmat, yeap, you're right. (However, not intended.;) 12:43
librasteve ab5stract: github.com/librasteve/raku-HTMX/bl.../README.md ... think like I have injected all my initial thoughts into this MVP attempt --- over to you and others now to take a look and feedback / contribute --- the big hole at the moment is the lack of any server side support - which maybe we need Hummingbird or Cro setup for 12:48
(was fun to hack on this so far)
[Coke] anyone using the MongoDB module? 14:01
kylese lizmat, just FYI: I think I got you wrong. Sorry for that. You nailed from the beginning. I guess 'self' should work for proper implementations. According to .HOW I have a situation where: class A == A.new == A.new(x=>"…") == A.new("…") != A.new.value("…") (That was very unexpected.) But, for today I'm done. Thx, again. 14:13
guest20240723 I'm currently reading docs.raku.org/language/concurrency , and while I appreciate the treatise, I was wondering if there are examples that (say) show for one thread to push something on to an array, and for another thread to pop things off the same array. 14:16
antononcube @Coke I am not, but considered using it after playing with "Marrow".
tellable6 2024-07-23T12:00:43Z #raku <wayland> antononcube Question: does github.com/antononcube/Raku-DSL-En...yWorkflows work for insert/update as well, or just querying?
guest20240723 I don't have much experience with concurrency / threading, so, if the process I've described for (say) an array doesn't meld well with things, please let me know. 14:17
I'm trying to have one thread "collect data" from somewhere, and another thread "process it", and I assumed that forming some sort of queue (using arrays) would be a way to approach the problem.
lizmat you'd want a Channel for that: docs.raku.org/type/Channel 14:18
guest20240723 lizmat thanks.  Reading.
lizmat arrays are non-thread safe 14:19
antononcube New module "Math::SpecialFunctions". I took the implementations from here-and-there. (RosettaCode, LLMs, Andrew Shitov's posts.) That package is too small to feature it separately in a post or video, so I am proclaiming its existence here. 14:28
At some point Raku has to have a fuller support of special functions. I would say, at least the ones in Python's "SciPy". 14:29
As usual for these kind of computational packages, extensive unit tests are very important. (I almost inclined to say that that is the harder part.) 14:32
[Coke] antononcube - in core, or module OK? 15:02
antononcube @Coke Speaking of special functions? If yes, definitely first in a module. For example, the Gamma-function implementation I put in is precise enough, but not that precise. (Although, it passes the precision tests for known values of Gamma.) It would be nice to compute to arbitary precision, like, say the Bernounlli-B numbers. But might require are fair amount of other algorithms to be in place. 15:07
The rest of the functions that are currently in "Math::SpecialFunctions" -- factorial, binomial, and bernoulli-b -- are computed at arbitrary precision with FatRats. 15:09
[Coke] Our usage of DivideByZero is inconsistent. We have 3 bits of data on the X: using, numerator, details. We are inconsistent about if we set any of them, and using/numerator seems to be a more commonly used, more specific pair, while "details" is used less often but contains the same details as "using". 15:16
lizmat: Should we have a more consistent usage? I'd say we should get rid of details, and make the other two required. - is this something we'd have to do in a new language version? (probably?)
antononcube 🤔 15:18
lizmat [Coke]: more generally, especially in light of localization, we need to get rid of "die" :-) 15:27
lizmat [Coke] but yeah, it feels like a language version thing 16:03
[Coke] ok; want a problem solving ticket? 16:11
lizmat guess so :-) if we don't have one already? 16:12
[Coke] I found it while writing docs, didn't check repo yet
Thanks.
[Coke] github.com/Raku/problem-solving/issues/434 16:20
guest20240723 Is there an equivalent to "perldoc" ?  I have rakudo 2022.02-01 installed on Ubuntu. 16:34
antononcube @guest20240723 Yes, see "Pod6" and "RakuDoc". But I strongly encourage you to use (much) more recent rakudo version. 16:35
guest20240723 antononcube , thanks.  When I get further in my journey, I will be looking at the more recent versions.  I'm trying to use threading as a justification to invest more in raku; but I want to get the basics worked out before I get to (say) operationalizing the entire thing. 16:38
[Coke] there is a command line at github.com/raku/rakudoc but you have to jump through a hoop to read the core docs with it
The best way to read the docs right now is docs.raku.org/ 16:39
antononcube Well, more recent versions for rakudo would make your investment decision more informed.
guest20240723 I have a bunch of things that would benefit from concurrency.  And I will stick with reading recent documents / tutorials on (say) docs.raku.org .  Specifically, there's an example here: docs.raku.org/language/concurrency , that has this text above it "It is also possible to obtain a Channel from a Supply" .  The example has 16:46
```sleep $r;``` , and when I run it on my machine, it appears that the "sleep $r" is not making the program wait $r number of seconds.
guest20240723 I wanted to "perldoc -f sleep" (or whatever the equivalent is) to see what the documentation for the current installed version was. 16:47
OH.  I think I see what's happening 16:49
await is spawning multiple threads that are all waiting for different amounts of time
err, the code is spawning multiple threads. 16:50
antononcube @guest20240723 Does this manifest in the most recent versions of rakudo? 16:51
guest20240723 I misunderstood the code.
[Coke] from a docs standpoint, if you're coming from perl, there is docs.raku.org/language/5to6-perlfunc#sleep, and also docs.raku.org/type/Date#sub_sleep 16:58
(for future ref, sounds like you figured this one out!) 16:59
guest20240723 thanks 17:04
xinming releasable6: status 17:22
releasable6 xinming, Next release in ≈2 days and ≈1 hour. There are no known blockers. Changelog for this release was not started yet
xinming, Details: gist.github.com/89fafe393c614de888...0f4f233f11
lizmat clickbaits rakudoweekly.blog/2024/07/22/2024-...e-toolbox/ 17:45
soverysour hey, what's the go-to authoring tool for raku? Mi6 18:08
or maybe another
antononcube Commaide 18:23
I mean, Commaide is another option.
[Coke] module authoring? many of us including liz use Mi6 18:51
antononcube ...and vi. 19:14
[Coke] I think we have a variety of editors, but yes, a lot of us old timers use vi. :P 19:16
en.wikipedia.org/wiki/Michigan_Terminal_System - what I learned vi on. :P
(ooh, and my school is listed in the wikipedia page) 19:17
antononcube Aha, pretty much both a correlation and causation, and deja vu all over again.
[Coke] m: say (1+2i).Int; 19:54
camelia Cannot convert 1+2i to Int: imaginary part not zero
in block <unit> at <tmp> line 1
[Coke] m: say (1+2i).Int; CATCH { default { put .^name }}
camelia X::Numeric::Real
[Coke] ... why is that throwing a ::Real and not the more generic CannotConvert? 19:55
... because Int is Real, which still surprises me after 20 years. :P 19:58
[Coke] wonders what is left for CannotConvert.
m: Inf.Int 19:59
camelia Cannot convert Inf to Int
in block <unit> at <tmp> line 1
[Coke] (that one)
Why is that a CannotConvert and not a Real?
[Coke] Looks like someone maybe decided to make an alias for CC and then didn't convert all the usages. 20:00
librasteve soverysour: for module authoring, App::Mi6 is indeed the go-to tool, for writing via an IDE then Commaide 20:38
tellable6 librasteve, I'll pass your message to soverysour
_grenzo @librasteve does fez work ok? 20:58
librasteve fez works well for me 21:01
[Coke] fez++ 21:17