🦋 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.
Nemokosch as I said - @list.elems will explode on you if you happen to have a lazy list 00:03
ugexe if it was lazy i would expect it to be $list.elems 00:17
a lazy list rather
m: my $a := (42, 99).map({ say $_ }); say ?$a; say $a.elems 00:18
camelia 42
True
99
2
Nemokosch m: my @a = lazy 1, 2, 3; say ?@a; say @a.elems 00:19
Raku eval True Exit code: 1 Cannot .elems a lazy list onto a Array in block <unit> at main.raku line 1
ugexe i don't think that 'lazy' does anything 00:20
Nemokosch I mean, you can see it does, can't you
rf Can I augment a role
ugexe its used internally
Nemokosch (the error message got fixed since but it still wouldn't work)
rf I keep hitting: expecting a generic role Cannot augment Role because it is closed 00:21
ugexe i see its listed in the docs
which kind of surprises me
Nemokosch "lazy" is a really unfortunate term for it because yes, something can be lazy without being "lazy" 00:23
a "lazy" lazy thing is, for example, an infinite sequence
m: my $seq = (1, 3 ... *); $seq.elems 00:26
Raku eval Exit code: 1 Cannot .elems a lazy list onto a Seq in block <unit> at main.raku line 1
ugexe m: my $seq := (42, 99).map({ say $_ }); say $seq.is-lazy; say $seq.elems 00:28
camelia False
42
99
2
Nemokosch m: my $seq = (1, 3 ... * == 100); #`[ this one is also infinite but it doesn't know about it ] $seq.elems
ugexe i guess if .is-lazy is False it can .elems a lazy list
Raku eval Failed while reading stream: Max execution time exceeded
ugexe even if it is indeed lazy
Nemokosch yes, it is decided by that exact check 00:29
this "lazy" rather means "shouldn't start fetching values from this" than laziness by usual terms 00:31
ugexe github.com/rakudo/rakudo/wiki/is-lazy
Nemokosch has anyone seen AlexDaniel and me at the same time...? lol 00:33
joke aside, I didn't know about the ranges part 00:34
el can you send data to a generator 00:41
Nemokosch what would that do? 00:44
elcaro You might be looking for Supply's 00:45
el def gen(): a = yield print(a) g = gen() next(g) g.send(1) # 1 00:46
^
Nemokosch next is part of the interface of the iterator, right? 00:47
el yes
Nemokosch then probably not
iterators don't take an argument to produce the next value 00:48
el if it also has yield from it will become a coroutine 00:49
Nemokosch I have used yield from but I didn't look at it as a coroutine, just recursion over a generator 00:50
el its like a context switch or smth
or await 00:53
Nemokosch elcaro is probably right 00:56
I'd look around Supply
elcaro jnthn's done a few conference talks on Asynchrony and Parallelism (with slides usually available on his site) that may also help digesting the different async/concurrent constructs 01:14
www.youtube.com/watch?v=l2fSbOPeSQs www.youtube.com/watch?v=hGyzsviI48M www.youtube.com/watch?v=E_ho6McixV0 www.youtube.com/watch?v=xg8tAv35YFg www.youtube.com/watch?v=xg8tAv35YFg 01:16
melezhik . 01:52
tellable6 2023-02-09T22:50:01Z #raku <rf> melezhik I have a large JVM based code base I want to run in CI, does Sparrow support JVM images?
melezhik rf let me see, anyone know what is the way to install rakudo-jvm on linux boxes?
I did not see anything on rakudo.org/downloads/rakudo for rakudo jvm 01:53
rakubrew seems does not have it also?
rakubrew download jvm-2022.12
Couldn't find a precomp release for OS: "linux", architecture: "x86_64", version: "2022.12"
.tell rf - I  am going to build docker image with rakudo-rvm installed from source (version 2022.12) and sparrow agent installed on it, so you could you use it in SparrowCI, I will let you know when it's ready 02:09
tellable6 melezhik, I'll pass your message to rf
rf . 02:13
Makes sense, I will try it
melezhik rf ++ 02:25
melezhik .tell rf - just to clarify, you mean you want to run some Java code on SparrowCI or you are interested in rakudo-jvm? 03:59
tellable6 melezhik, I'll pass your message to rf
el how do i create a coroutine 08:27
oh its start 08:37
moritz `start` starts a task that potentially runs in its own thread, governed by the currently active thread pool scheduler 09:07
which isn't quite the same as a coroutine, if my understanding of threading/coroutines is correct
nine Coroutines don't require parallel processing. They are just routines that maintain their state while they give other routines a chance to run. gather/take is probably closest to what people expect. 09:52
That said, I don't think the concept of coroutines forbids actual parallel processing. 09:53
Nemokosch does that mean that "start creates a coroutine"? 09:55
lizmat no, what moritz said: `start` starts a task that potentially runs in its own thread, governed by the currently active thread pool scheduler 10:02
if the current threadpool scheduler doesn't support threads (like CurrentThreadScheduler), then "start" is the same as "do" 10:04
remember: it's all pluggable in Raku :-)
Nemokosch okay, so it runs to completion in the thread it's assigned to? 10:05
lizmat in 6.c it did, in 6.d there is no such guarantee 10:10
if the thread is waiting for something, it may get another job to do 10:11
this allows Raku to have more connections open in e.g. Cro than there are threads
Nemokosch I'm just trying to figure out if what start does matches "routines that maintain their state while they give other routines a chance to run" 10:18
and it feels like we are entering S5 modular logic 😅 10:19
lizmat well, in Raku s/routine/block/ and I guess that'd be a correct description 10:20
el gather/take = coroutine so how do i await in gather takr coroutine 10:39
await? 10:41
Nemokosch it would help to know what you are actually trying to achieve 10:45
these are the parts of any language that probably won't map 1-to-1 10:46
el i think just use start and Channel 10:50
Nemokosch Channel is like a queue 10:51
if that's what you mean
el those are sufficient
Nemokosch you probably know Promises 10:52
the interface is really similar to JS, even
el ik 10:55
start also create promises
lizmat see also: andrewshitov.com/2019/09/09/sleep-...in-perl-6/ 10:58
Nemokosch constant time! 10:59
el more like O(n) time 11:07
Nemokosch nope, it's """"constant"""" 11:09
of course that's assuming that there are arbitrarily small time units
and then you can just divide with a huge number
In other news, I'm done with the egoistic author (well, not even author, rather just maintainer) of Ddt; another thing goes to the bucket list... 11:18
el whos ddt 12:27
Nemokosch Ddt is supposedly an alternative to mi6 12:54
It was meant to be more elaborate from what I can tell 12:55
lizmat since it's a developers tool, I don't think it's worth spending much time on unless you're a user 13:21
el and what happened with the author 13:32
rf .tell melezhik I am interested in both 13:59
tellable6 rf, I'll pass your message to melezhik
Nemokosch The author stopped using the language years ago basically, leaving the tool in a highly incomplete stage 14:29
lizmat the maintainer you mean? skaji san is still maintaining App::Mi6 afaik ? 14:31
Nemokosch skaji is maintaining App::Mi6
to be honest, if I thought the situation was so great, I wouldn't bother with the whole thing 14:33
I think App::Mi6 could be maintained better - but it's being maintained so I don't have much business there
however, Ddt, which I think has a more ambitious core design, is completely unmaintained for years 14:35
in this time, all the contribution from the supposed maintainer was, as much as I can see: 1. complaining how Raku is not production-ready 2. leaving PR's dangling 3. preaching about having "high standards" 14:36
tonyo fez is getting some dist features 14:37
tellable6 2023-02-09T22:21:23Z #raku <melezhik> tonyo - that's ok, I can wait till the issue is fixed, anyway I have already renewed my fez token, so it's not possible to reproduce the bug now
tonyo i'm also very bad about PRs, i get 500+ notifications from github a day and they just kind of turned into noise 14:38
my most long standing one being from when i worked on nodejs core 10+ years ago and probably my most downloaded module
Nemokosch fez dist features - that's definitely a welcome thing 14:40
frankly, mi6 is better than nothing, it's good enough for the caretaker stuff I usually do with a module 14:41
but to think that this is "what we can offer", well... in that light, it's not much
El_Che tonyo: I disabled github notifications, too many 14:43
tonyo i already see a bug in ddt that i was getting in fez
El_Che: it's awful, and the `focused` dashboard is equally poor 14:44
Nemokosch for github notifications - the other problem is NOT getting notifications about something you might want
tonyo currently working on removing the os dependency of gzip and tar from fez so it has all it needs to package directly
Nemokosch like "github discussions"; for the main Raku repos, I would like to be notified about everything 14:45
[Coke] . 15:06
tellable6 2023-02-08T02:25:31Z #raku <melezhik> [Coke] , do you mean me , when say "create a ticket" ?
2023-02-08T17:42:58Z #raku <melezhik> [Coke] - github.com/Raku/doc/issues/4195
hey [Coke], you have a message: gist.github.com/ee67b3b2b172694c21...0ec71530b6
melezhik o/ 16:42
tellable6 2023-02-10T13:59:34Z #raku <rf> melezhik I am interested in both
melezhik .tell rf for just java app testing please use this - github.com/melezhik/SparrowCI/blob...lpine.yaml 16:43
tellable6 melezhik, I'll pass your message to rf
melezhik .tell rf as for rakudo with jvm backend I have a couple of blockers preventing me from building docker images for SparrowCI - github.com/rakudo/rakudo/issues/5197 and github.com/rakudo/rakudo/issues/5198 16:45
tellable6 melezhik, I'll pass your message to rf
melezhik .tell rf I mean I can build a custom SparrowCI image with rakudo jvm backed in, but it's not going to have a zef or pakku dependency managers, I am not sure this is something you're after ... 16:49
tellable6 melezhik, I'll pass your message to rf
rf .tell melezhik Thank you so much I will try the Java one this weekend 17:23
tellable6 rf, I'll pass your message to melezhik
melezhik . 17:35
tellable6 2023-02-10T17:23:04Z #raku <rf> melezhik Thank you so much I will try the Java one this weekend
melezhik rf: sure 17:36
tonyo m: multi MAIN('s'|'short') { 'short'.say; }; 18:16
camelia ===SORRY!=== Error while compiling <tmp>
Malformed parameter
at <tmp>:1
------> multi MAIN('s'|⏏'short') { 'short'.say; };
expecting any of:
constraint
p6steve since Dan and Dan::Polars have a common API, I thought I'd do a cheeky benchmark gist.github.com/p6steve/4684eeca6b...1de16e0464
turns out that Rust is about 60x faster than Raku to sum a DataFrame column 18:18
tonyo i guess rust has some optimization to do 18:19
p6steve BTW I suspect that this is roughly what you would get comparing vanilla Python with Python + (Rust) Polars
well, I am spending serious tuits on Dan::Polars these days and would like there to be some concrete benefit ;-) 18:20
lol 18:21
Nemokosch yeah that response really was tongue in cheek
tonyo hmm, do we have a way of using a junction in the signature like that to shorten MAIN argument matching? something akin to MAIN(:h(:$help)) which matches `-h --help` ? 18:31
Nemokosch you can just "nest" this pair syntax as much as you want I think 18:34
:h( :help( :blah( :$bar ) ) ) 18:35
tonyo i want it to match `someprog h|help`
without the flag requirement
Nemokosch hmm
no better idea than the where clause so far... 18:38
tonyo yea that mangles the auto uSAGE 18:43
m: multi MAIN(Str $fff where * ~~ 'x'|'xxx') { }
camelia Usage:
<tmp> <fff>
Nemokosch Even when anonymous? 18:46
tonyo yea 18:49
even less info that way 18:50
m: multi MAIN(Str:D $ where * ~~ "r"|"run") {}
camelia Usage:
<tmp> <Str where { ... }>
Nemokosch Krrr 18:53
rf Finally figured out how to get RakuLSP working on Emacs 19:02
tellable6 2023-02-10T03:59:18Z #raku <melezhik> rf - just to clarify, you mean you want to run some Java code on SparrowCI or you are interested in rakudo-jvm?
2023-02-10T16:43:23Z #raku <melezhik> rf for just java app testing please use this - github.com/melezhik/SparrowCI/blob...lpine.yaml
2023-02-10T16:45:13Z #raku <melezhik> rf as for rakudo with jvm backend I have a couple of blockers preventing me from building docker images for SparrowCI - github.com/rakudo/rakudo/issues/5197 and github.com/rakudo/rakudo/issues/5198
2023-02-10T16:49:08Z #raku <melezhik> rf I mean I can build a custom SparrowCI image with rakudo jvm backed in, but it's not going to have a zef or pakku dependency managers, I am not sure this is something you're after ...
rf I think I'll write a guide for it
tonyo rf: are you interested in testing the fez dist management side? 19:05
there's enough in there for it to be useful
(but no guides for it yet)
[Coke] <garak>Especially when anonymous</garak> 19:06
rf Yeah I'm pretty swamped until sunday, if you can wait until then :D
tonyo i can
rf Excellent, i'll let you know then! 19:07
tonyo open testing, just working on getting everything in there still
rf Totally, I'm excited to see what you came up with
tonyo it's on the branch `dist` @ github.com/tony-o/raku-fez - once checked out you can just `zef install --force-install .` and use fez dist funcs
rf tonyo: Holy-cow just quickly skimmed that branch, this looks amazing! 19:13
Geth doc: coke self-assigned Need to note unordering-ge for Map/Hash/QuantHash/Bag/Set/Mix/BagHah/SetHash/MixHash github.com/Raku/doc/issues/2174
coke self-unassigned Need to note unordering-ge for Map/Hash/QuantHash/Bag/Set/Mix/BagHah/SetHash/MixHash github.com/Raku/doc/issues/2174
19:28
tonyo rf: 🙌 19:29
Nemokosch rf++ 20:51
rf What's the best way for a multiline string in an array literal? 21:56
lizmat q:to/STRING/; 22:07
foo
bar
STRING
docs.raku.org/language/quoting#Heredocs:_:to 22:08
rf How can I do this within an array? 22:15
like [q:to/EOF/ abc abc abc EOF, ...
Nemokosch > The contents of the heredoc always begin on the next line, so you can (and should) finish the line. 22:17
Moreover:
> You can begin multiple Heredocs in the same line. If you do so, the second heredoc will not start until after the first heredoc has ended.
redashes Hello 23:03
rf redashes: Hello! 23:16
tellable6 rf, I'll pass your message to redashes
rf What is the ~ sigil? 23:18
I keep seeing it, but not sure what it does, coerce to string?
moritz yes, though it's a prefix, not a sigil 23:19
rf That's what I thought, thanks! 23:20
I guess its the string version of my $abc = '123'; +$abc; 23:21
[Coke] this gives a LOT more info, but you can see it's a prefix with: raku --target=ast -e '~"3"' 23:26
[Coke] er, ~3 is sufficient. :) 23:30
Geth doc/main: ebd0a68122 | (Monalika Patnaik)++ (committed using GitHub Web editor) | CONTRIBUTING.md
Update CONTRIBUTING.md (#4197)

  * Update CONTRIBUTING.md
23:38
[Coke] Anyone who has some spare tuits to work on documentation, I've created a milestone on raku/doc for things that I'd like to get done by the end of March: 23:41
github.com/Raku/doc/milestone/4 ; if any of these are on topics you're interested in, or think you can write something up for, we'd love the help, feel free to swing by #raku-doc to ask questions about how docs works, and ask here about how stuff works (if needed) 23:43
We also still need help running QA against the upcoming site; feedback about gaps compared to the original site esp. welcome. 23:44