🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | 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 8 June 2022.
tonyo . 00:56
SmokeMachine Is there a blin run for 2022.06? github.com/rakudo/rakudo/issues?q=...issue+blin 01:11
Nemokosch why is "The use of hash variables in regexes is reserved" and what does this even mean? 09:47
lizmat Nemokosch: reference ? 09:48
tellable6 lizmat, I'll pass your message to Nemokosch
MasterDuke $ variables just interpolate their contents, @ variables interpolate as alternations, % variables don't have a function yet 09:50
Nemokosch reference: reality 09:51
===SORRY!===
The use of hash variables in regexes is reserved
at /home/ASTRON-INF/pm7342/raku_helpers/./diffblame.raku:26
------> when /^ 'Csak ebben: ' (%base-path⏏<esko>|%base-path<kako>) (.*?) ': ' (.*)
what does "alternations" mean?
also, I think this is kind of like a sabotage
no black magic needed, I just wanted the content 09:52
dutchie m: my @foo = <one two three>; say 'one' ~~ /@foo/ # equivalent to / one | two | three / 09:53
camelia 「one」
Nemokosch so if I do @%base-path
it will do exactly what I actually need? xD
dutchie you might want @(%base-path.keys) or something 09:54
since @%base-path will be a list of pairs
Nemokosch values, rather 09:55
but yes
let's see...
well at least it doesn't error, can't check it yet 09:59
you know, these are kind of show-stoppers in my opinion 10:00
Raku is "like a jungle sometimes", its mental load scales uncomparably worse than Python 10:01
in Python, regexes are just strings. This may not be elegant but it's ridiculously powerful once you go beyond trivial in any "deviant" way
I'm still yet to find this sort of safety in Raku
that you can just safely use what you know perfectly
lizmat well, in Raku, regexes are just another way to write code
Nemokosch how do I generate it, then? 10:02
I can't always hardcode it
lizmat well, before RakuAST, using EVAL I'm afraid
afaik, RakuAST already has most, if not all, API in place to generate regular expressions 10:03
nine? ^^
Nemokosch the API doesn't have to be a raw string
but there is legitimate need for some API
RakuAST... it's like the land of promise
😂
lizmat well, yes, it is in a way...
a promise that is getting closer... 10:04
Nemokosch like I am getting closer to a working script 10:07
😛
and eventually, I can just "cast" everything to $, for values, this is feasible 10:09
by the way
say you have a dict
is there a way to obtain values with containers? 10:10
other than using them LHS in an assignment, of course 10:11
for example, iterating over the values as containers
okay... is there anything I should know about dynamic variables in react blocks?.... 10:20
MasterDuke github.com/rakudo/rakudo/issues/4654 might have some relevant info 10:22
lizmat .values on a Hash returns containers
m: my %h = :42a, :666b; dd %h; $_++ for %h.values; dd %h 10:23
camelia Hash %h = {:a(42), :b(666)}
Hash %h = {:a(43), :b(667)}
lizmat m: my %h = :42a, :666b; dd %h; $_++ for %h<a b>; dd %h # also slices
camelia Hash %h = {:a(42), :b(666)}
Hash %h = {:a(43), :b(667)}
Nemokosch lizmat: I see, that's not bad 10:26
lizmat BTW, same for BagHashes / MixHashes
m: my BagHash %h = :42a, :666b; dd %h; $_++ for %h<a b>; dd %h
camelia Type check failed in assignment to %h; expected BagHash but got Int (42)
in block <unit> at <tmp> line 1
lizmat ooh
Nemokosch what about something that retrieves the key as well, either as elements one after the other or as pairs?
lizmat m: my BagHash %h = :42a, :666b; dd %h; $_++ for %h.values; dd %h
camelia Type check failed in assignment to %h; expected BagHash but got Int (42)
in block <unit> at <tmp> line 1
10:27
lizmat m: my BagHash %h = (:42a, :666b); dd %h; $_++ for %h.values; dd %h
camelia Type check failed in assignment to %h; expected BagHash but got Int (42)
in block <unit> at <tmp> line 1
lizmat hmmm... /me makes mental note :-)
Nemokosch MasterDuke: thank you; so long story short, they are pretty much useless 10:28
since stdout needs to be tapped before start
basically, the processing code needs to be before start
well I can live without them, it's just... at this point, I feel I need a safe subset of Raku
and I'm afraid the safe subset of Raku wouldn't be much more attractive than Python 😅 10:30
SmokeMachine m: my %h is BagHash = :42a, :666b; dd %h; $_++ for %h.values; dd %h 10:35
camelia ("b"=>666,"a"=>42).BagHash
("b"=>667,"a"=>43).BagHash
Nemokosch don't take me wrong, though 10:38
I will be insanely happy once this works as intended
but at the same time, this is just a helper script, basically I have this day to see if it's of any use
lizmat SmokeMachine++ # me clearly not awake enough yet :-) 10:39
SmokeMachine m: my %h is BagHash = :42a, :666b; dd %h; for %h.kv -> $key, $value is rw { $value += ord($key) }; dd %h # Nemokosch 10:40
camelia ("a"=>42,"b"=>666).BagHash
("a"=>139,"b"=>764).BagHash
SmokeMachine Nemokosch: what's pretty useless? 10:41
tellable6 SmokeMachine, I'll pass your message to Nemokosch
SmokeMachine m: my $PROCESS::BLA = 42; sub say-ble { say $*BLE }; react whenever Supply.from-list: <a e i o u> -> $vogal { say $*BLA; my $*BLE = $vogal; say-ble } # Nemokosch: about react block and dyn var 10:48
camelia 42
a
42
e
42
i
42
o
42
u
Nemokosch so rw works 10:49
I think I messed something up with the destructuring
oh no, the markdown again...
so we have $*BLE
and $*BLA maybe?
SmokeMachine yes, $*BLA and $*BLE 10:50
Nemokosch I wonder if image attachments are traversed... 10:51
SmokeMachine m: gist.github.com/FCO/9769e89ab94f10...7add637746 10:52
camelia 42
a
42
e
42
i
42
o
42
u
Nemokosch okay let tell hit 10:52
tellable6 2022-06-07T10:07:31Z #raku <MasterDuke> Nemokosch: what do you mean about numeric context?
SmokeMachine Nemokosch#9980: Maybe this ☝️ would help?
tellable6 2022-06-09T09:48:54Z #raku <lizmat> Nemokosch: reference ?
2022-06-09T10:41:09Z #raku <SmokeMachine> Nemokosch: what's pretty useless?
Nemokosch so the barrier is at the react block? 10:53
so what I understand: as long as the dynvar is purely inside the react block, things are fine 10:54
SmokeMachine m: gist.github.com/FCO/9769e89ab94f10...7add637746
camelia 42
a
42
e
42
i
42
o
42
u
SmokeMachine m: gist.github.com/FCO/9769e89ab94f10...7add637746 10:56
camelia 0
a
1
e
2
i
3
o
4
u
SmokeMachine Nemokosch: ☝️ 10:57
tellable6 SmokeMachine, I'll pass your message to Nemokosch
Nemokosch something feels broken... 11:01
too many messages
SmokeMachine I was changing the code and posting again... sorry for flooding...
Nemokosch I just realized Z can be illustrated with Harder better faster stronger 11:26
SmokeMachine: gotcha, and I think I understand 11:28
p6steve i could use some help with concurrency ... I would like to do a pattern like this: main (p1) defines a sub(), then forks a new process (p2), p2 calls sub, p1 captures stdout of p2, p2 ends 12:37
(so the fork has the process context of p1)
I couldn't figure out how to do this with Async::Process seems like this is for running an external program 12:39
I have RTFMd about .fork my $promise = Promise.start( { my $i = 0; for 1 .. 10 { $i += $_ }; $i} 12:43
);
say $promise.result; oops 12:44
I have RTFMd about .fork ... docs.raku.org/language/5to6-perlfunc#fork
MasterDuke there has been an nqp::fork added since that doc entry was written
p6steve MasterDuke: thanks ... I try to live in raku land rather than NQP ... guess that this has not yet surfaced to the raku API? 12:46
MasterDuke: (how) can I call this NQP fn from raku? 12:47
MasterDuke correct, nor has it been exposed in rakudo
nine lizmat: yes, RakuAST should have somewhat complete regex support already
MasterDuke m: use nqp; say nqp::add_i(1, 2)
camelia 3
lizmat nine: I wonder whether it would make sense to put that part of RakuAST already into master ? 12:48
so that people could start playing with it ?
p6steve hmmm - I vaguely recall tricks like (post fork) read own pid to decide whether I am p1/p2 then maybe some way to connect std out to std in - but too vaguely to want to go so deep 12:53
back to the drawing board 12:54
lizmat p6steve: with Raku, you generally don't want to fork 12:58
ugexe thats putting it lightly 13:22
p6steve yes, that's definitely out - don't suppose that there's a way to pipe stdout into a variable in the same process? 13:37
lizmat sure, change $*OUT :-) 13:41
p6steve: see e.g. raku.land/zef:lizmat/silently 13:42
specifically github.com/lizmat/silently/blob/ma...rakumod#L7 the Capturer class 13:43
p6steve lizmat: that's the ticket! perfect ... you are a star! 13:47
p6steve alas silently redirects stdout in my script ... but the stdout I want comes from nativecall and a Rust lib.so ;-( 14:07
guess I am just going to have to make a tempfile - hohum 14:08
[Coke] Right, the silent trick works on the raku handle, not the underlying one 15:12
s/underlying/system/
[Coke] p6steve: you could consider something like run with :out... 15:12
oh, you're using like rust inline or something? 15:13
[Coke] catches up
melezhik Hi! 15:17
melezhik I am thinking about spinning  up a service that allow people to run integration tests against their docker images, similar to SparkyCI but with focus on docker 15:18
so a user could deploy their docker images into temporary docker instance and run https requests against it 15:19
or run some ssh commands within docker instance to check internal structure
could be useful for Raku devs building services on Raku 15:20
just testing a water here if this is something people might find useful?
I am thinking about testing raku.land or whatever Raku related services that are distributes as docker images 15:21
again because I am going to build and own this service it's possible to bake as much Raku integration as possible into it ...
ant thoughts? I'd appreciate for a feedback  ... 15:22
[Coke] m: my @out; for (^1000).grep(*.is-prime).join.comb { last if @out.elems == 10; next if @out.grep($_); @out.push: $_ } put @out; 15:37
camelia ===SORRY!=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> ; next if @out.grep($_); @out.push: $_ }⏏ put @out;
[Coke] m: my @out; for (^1000).grep(*.is-prime).join.comb { last if @out.elems == 10; next if @out.grep($_); @out.push: $_ }; put @out;
camelia 2 3 5 7 1 9 4 6 8 0
[Coke] (order of digits as they appear in prime numbers, wh 15:38
ee)
Surely that can be golfed. 15:39
ugexe probably want to get rid of the .join since then the iteration through ^1000 will have o complete 16:09
m: (0..Inf).grep(*.is-prime).join.map({ say $_ }) 16:14
camelia ...
ugexe uh what
m: say (0..Inf).join
camelia ...
ugexe That doesn't seem correct
I think I'd rather have it hang indefinitely 16:15
gfldex m: (0..Inf).join.is-lazy.say; 16:29
camelia False
gfldex m: (0..Inf).^can('join')[0].&{.file, .line}.say; 16:32
camelia (SETTING::src/core.c/Any.pm6 178)
thundergnat m: say (^110).grep(&is-prime)».comb.flat.unique 16:35
camelia (2 3 5 7 1 9 4 6 8 0)
tellable6 2021-06-03T11:02:00Z #raku-dev <lizmat> .tell thundergnat that looks like a bug, could you make an issue for it?
2021-06-03T12:57:00Z #raku-dev <lizmat> .tell thundergnat github.com/rakudo/rakudo/commit/89fd8a8df8 tests would be appreciated :-)
gfldex Range.join ends up in List.join with a List made with List.from-iterator 16:35
And since (0..Inf) is lazy, we end up with a stringification for a lazy list. 16:37
Actually, we might end up with `nqp::if($infinite,'...','')` . 16:38
m: (0..Inf).join.put 16:43
camelia ...
gfldex I can't find stringification of infinite lists in Roast. 16:48
p6steve Coke: yep I'm making a lib.so with rust then nativecall ing it ... finally bit the bullet and doing as Nativecall callback 17:13
p6steve Coke: I have put the recipe for Rust callbacks here github.com/p6steve/raku-Inline-Rust 17:33
p6steve just went from 1.1k to 1.2k rakoons on reddit 20:09
lizmat yup, yesterday... well actually it just got past 1150 (1154 now) 20:10
jgaz It's still progress. 20:22
Nemokosch Is %hash>>.methodcall described somewhere in the docs? 21:04
[Coke] docs.raku.org/language/operators#m...op_%3E%3E. 21:05
Nemokosch I don't see anything about the behavior with hashes 21:10
The very slight mention I could find at the general hyper description: 21:11
> Hyper operators can work with hashes. The pointy direction indicates if missing keys are to be ignored in the resulting hash. The enclosed operator operates on all values that have keys in both hashes.
Anton Antonov What does determine the popularity of reddit group? (Lilke /r/rakulang.) The quantity of the posts? The quality? Or, as in Raku's case, "just" the number of Raku-users and/or Raku-curious? 21:12
[Coke] was just pointing at the >>. operator. To offer an example: 21:13
m: my %e = <a b c d>; dd %e>>.uc; 21:14
camelia {:a("B"), :c("D")}
Nemokosch It does seem that de facto it operates on the value
I'm already using that
I was just curious if this behavior is explicitly recorded somewhere 21:16
p6steve m:1154.round(100) 21:34
[Coke] $ ack '%.*>>\.' # 5 files in roast, 10 hits or so
evalable6
[Coke] m: dd 1154.round(100) 21:35
camelia 1200
[Coke] m: dd 1154.round(103)
camelia 1133
p6steve m: dd 'haha' 21:41
camelia "haha"
Nemokosch haha 21:41
gfldex <@297037173541175296> >>. is an operator and those coerce by design. Since >>. will operate on List, it will coerce any LHS to that. 21:59
Nemokosch that doesn't explain the behavior, though. The has turns into a list of pairs, what happens then? 22:01
also, new thing
what is the difference between |(blah) and (blah).Slip? 22:03
that doesn't explain the behavior, though. The hash turns into a list of pairs, what happens then? 22:04
gfldex see: github.com/rakudo/rakudo/blob/mast....pm6#L1605 22:07
Nemokosch does this mean they should always work identically? because they don't... 22:13
again, what is the catch? 😂 22:14
drakonis huh, activity. 23:51
nice.
Voldenet |(blah) and (blah).Slip work the same, sort of
m: my $s = |(1); my $s2 = (1).Slip; dd $s; dd $s2;
camelia Slip $s = $(slip(1,))
Slip $s2 = $(slip(1,))
Voldenet …however 23:52
m: dd |(1); dd (1).Slip;
camelia 1
slip(1,)
Voldenet I think it only makes difference when used in context of method call 23:54