librasteve gfldex: two reasons I do. it use the feed operator (i) i wanted to prototype a bind >>= operator for inclusion in the Definitely module and (ii) vanilla feed afaik is not amenable to Monad return types [I could be wrong about this] … wamba has made a very good suggestion to do this (use the feed) in the blog post comments and I will rewrite his way as soon as I can 00:55
01:43 hulk joined, kylese left 02:07 Aedil joined 02:15 hulk left, kylese joined 05:30 Sgeo_ left 07:50 holyghost joined 07:57 dakkar joined 09:36 DarthGandalf left 09:38 DarthGandalf joined 12:54 MasterDuke left 13:13 dakkar left 13:26 dakkar joined
wamba commented on my post and used the is prec trait - I can't find this in the docs ... anyone know what it is? 14:51
(and what it is doing in the example - rakujourney.wordpress.com/2024/10/...omment-800 )? 14:56
ab5tract Hmm, it should be in the docs indeed 15:00
We used to have it in an example on the front page after all
I forget the specific syntax for defining it but this is the precedence for feeds: docs.raku.org/language/operators#Operators 15:03
librasteve oh, I thought this was is equiv 15:04
ab5tract Arg, I copied the back-to-top link. It’s the section at the very close to end
librasteve still mystified ... proto infix:«>>=»($ ,$) is prec(prec => ‘f=’) {*} ... what is the named arg prec, what is f= 15:08
ab5tract Right, like I said I have lost track of the syntax:( 15:11
I think the looser/tighter traits are better documented? 15:12
librasteve oh, sorry
ab5tract prec definitely looks like an ancient artifact 15:13
If it’s not marked as an implementation detail, it probably should be 15:14
librasteve ok, I guess that is prec(prec => 'f=') means set precedence level to prec => xx where f= is an incantation for feed operator precendence
ab5tract That’s my guess as well 15:15
librasteve cool - tx!
ab5tract I think tighter/looser ( is there an equivalent .. erm, equivalent?) traits are the “modern” (or at least legible) approaches 15:16
I am not at home to check Rakudo source 15:17
But “f=“ almost certainly means “at the precedence level of Feed”
librasteve ok - thanks for the help! 15:25
ab5tract Finally found the docs reference : docs.raku.org/syntax/is%20tighter 15:29
Still ancient enough that 5 characters are shaved from equivalent because lot course we need to take care not to burden our programmers with too many letters while they are doing that everyday task of setting operator precedence 15:31
librasteve that's very helpful - thanks! sadly I am getting somewhat confusing (not related?) error from wambas example (which I am keen to employ) ... have raised this on SO stackoverflow.com/questions/790868...ce-to-feed so everyone can try the code and ut me straight ... wamba is a visitor to SO so hopefully they will pick up on it 15:41
appreciate the steer
15:58 DarthGandalf left, Some-body_ joined 16:01 Some-body_ is now known as DarthGandalf
ab5tract librasteve: what happens if you add the trait on each candidate? 16:02
16:13 Xliff joined
Xliff \o 16:13
timo o/ 16:14
16:34 dakkar left
Xliff @.shift is atomic, yes? 16:40
Or do I need to lock it? 16:41
timo i don't think it's atomic, we don't use atomic operations to load and change the count and offset attributes in arrays 16:44
Xliff So I need to lock it in a multi-threaded app? 16:48
I guess I'm being a bit inaccurate in my use of language. 16:49
If I don't need to lock something to prevent a race condition, I consider that operation "atomic"
And that might be incorrect.
timo you'll want to use locking if you use methods on array that also change the number of items 16:50
the "changing how many items there are" and "getting the last/first item" operations can interleave in unfortunate ways, causing funny things like getting the same item out twice and one item just being lost 16:51
we do have "enter-single-user-mode" and "leave-single-user-mode" bits in VMArray but i think that's not locking, just warning if you're in trouble? 16:53
lizmat Xliff: aren't you looking for a Channel ? 16:57
timo there's also a few async and atomic datastructure modules in the ecosystem right? 17:08
lizmat raku.land/?q=concurrent 17:19
Xliff lizmat: If that means pull out in the same order I put in, then maybe so. 17:22
lizmat docs.raku.org/type/Channel 17:23
timo yeah channel is exactly what you want 17:28
librasteve ab5tract: yep applying is looser on the individual candidates works - i can live without pronto for now - brilliant, thanks! ps. will update the so 17:39
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/10/14/2024-...rritonads/ 18:35
librasteve ab5tract: quick update - applying more testing without proto - I can now confirm that is looser(&infix:<xor>) works as in the code runs, but does NOT give the same Sequencer precedence as ==>, more checking and I CAN apply is prec(prec => ‘f=’) at the candidate level and that does appear to produce the right precedence (so wamba was right to reach for this arcane syntax all along) 19:04
question now seems to be (i) is getting Sequencer precedence level a feature we want in raku (I vote yes since I value the outcome) and then (ii) how do we recommend coders get this precedence - should the arcane is prec be kept or is there another way.... curious to hear if folk think this is a good topic for a Problem Solving Issue (I have not yet checked to see if there is one already btw)?? 19:06
ab5tract Yeah I think it’s worth a problem solving for sure 19:08
I think that there is an argument to be made that we should be providing an enum of precedence levels rather than ( or in addition to) passing routine names 19:09
librasteve yeah - I was thinking of just a numeric value, but an Enum would be cleaner 19:21
19:21 Aedil left 19:40 guifa left
fwiw I would say you want to use locking on any raku data type where you are changing it from more than one thread (not only changing the length, but also changing values, keys, etc) 19:44
19:50 stanrifkin joined 19:53 guifa joined 20:21 guifa left 20:29 guifa joined 21:54 guifa left 22:01 merp left 22:04 merp joined
patrickb o/ I'm looking for a way to reach for the OS level FD of the STDIN of a Proc::Async. I am willing to mess with the rakudo source. Does anyone know if there is a chance? 22:07
22:08 stanrifkin left
Xliff Um. There's .native-descriptor available on the IO::Handle that do it. 22:10
^^ patrickb
patrickb $!process-handle is the handle I'm interested in? 22:13
Xliff Looking...
22:13 guifa joined
patrickb It's at least the one passed to nqp::asyncwritebytes() 22:14
and the one that's nqp::closefh()ed
Xliff Ick. 22:20
I've traced it back to src/io/procops.c line 991
Then it goes over my head.
Was hoping it was just an IO handle, but it's created by Moar and accessed via an NQP operation. 22:21
[Coke] my $proc = Proc::Asyc.new; $proc.stdin.native-descriptor? 22:29
22:35 guifa left
Xliff That's what I was thinking../. 22:38
23:16 Sgeo joined
elcaro_ .sort(:k) behaving weird on Seq's... given @a = <A B C>,<1 2 3 4 5>,<w x y z> ... 23:30
@a.map({ |[^.elems] }).sort(:k) ~~ (0,0,0,1,1,1,2,2,2,3,3,4) 23:31
Need to convert to List/Array first
[ @a.map({ |[^.elems] }) ].sort(:k) ~~ (0,3,8,1,4,9,2,5,10,6,11,7)
sort() func doesn't have this issue.
I will raise an Issue
23:36 guifa joined
Xliff m: '➿'.uniname.say 23:39
camelia DOUBLE CURLY LOOP
Xliff m: '➿'.ord.say 23:40
camelia 10175
elcaro_ I must say, I'm not a fan of that symbol, tho I think giving round-robin a metaop is a decent idea; I'm pretty sure the suggestion has come up in previous years of IRC chat 23:42
In line with X and Z, it would be nice if it had a single cap ascii version... it's a shame R is taken. 23:43
`E` isn't a bad idea, visually symbolizing "this, then this, then this...", but then again... maybe round-robin is not common enough to deserve a single ascii letter. Maybe `RR` is a possibility. Just idle thoughts. 23:46
timo m: my @a = <A B C>,<1 2 3 4 5>,<w x y z>,<a b>,<9 8 7 6 5 4 3 2 1>; @a.map({ |[^.elems] }).say 23:48
camelia (0 1 2 0 1 2 3 4 0 1 2 3 0 1 0 1 2 3 4 5 6 7 8)
timo m: my @a = <A B C>,<1 2 3 4 5>,<w x y z>,<a b>,<9 8 7 6 5 4 3 2 1>; @a.map({ |[^.elems] }).sort(:k).say
camelia (0 0 0 0 0 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5 6 7 8)
timo m: my @a = <A B C>,<1 2 3 4 5>,<w x y z>,<a b>,<9 8 7 6 5 4 3 2 1>; @a.map({ |[^.elems] }).sort().say
camelia (0 0 0 0 0 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5 6 7 8)
elcaro_ m: my @a = <A B C>,<1 2 3 4 5>,<w x y z>,<a b>,<9 8 7 6 5 4 3 2 1>.map({ |[^.elems] }); @a.sort(:k).say 23:49
camelia (4 1 0 3 2)
elcaro_ oops
m: my @a = (<A B C>,<1 2 3 4 5>,<w x y z>,<a b>,<9 8 7 6 5 4 3 2 1>).map({ |[^.elems] }); @a.sort(:k).say
camelia (0 3 8 12 14 1 4 9 13 15 2 5 10 16 6 11 17 7 18 19 20 21 22)
elcaro_ This should be the answer.
That one worked because I assigned @a after the .map 23:50
timo could be there needs to be more candidates for method sort that have :k, not just for List:D
gotta run 23:53
elcaro_ o :k
guifa in retrospect, maybe we should have used F for Flip (instead of R for Reverse), so we could use R for Roundrobin 23:56