14 Jul 2024
thowe Well, the documentation itself shows a good example of what I mean... The first example shows "$proc.stdout.lines" and then the line is in $_. The second example, "Proc::Async without using a react block:", shows $proc.stdout.tap creating "$v". 22:23
How would I do the equiv of creating "$v" with the lines method?
Might be a moot point as I can't get a react block to actually do anything. 22:30
here's both versions in one snippet: gitlab.com/-/snippets/3728658 22:35
The problem with tap, is that the lines I am getting from my maillog will be broken up, and so I can't rely on having an actual line to parse. 22:36
My problems with the lines/react method are legion. How do you make your program do anything else other than the react loop? How do you get the line as a variable you name like with tap? Oh, yeah, also, why does it not actually seem to get any data ever... 22:38
tap seems to work until I get a half line, and then the other half of the line as another line.
I got this from an example in the book "Raku Recipes" but it doesn't really work. 22:39
recipe 2-3
I'm sure most of my confusion is just not understanding reactive programs or supplies or whatever, but the question about assigning a variable to lines remains 22:46
I'm really getting lost in the weeds here, though. What I would really like is to know how to get tap to take the lines as they are given and not break them up. 22:48
so, trying to do something where I assemble the lines.. 23:34
ab5tract When creating a block, you can specify a signature. This allows you to name the parameter and reference it by that name in the block 23:35
m: (-> $param { dd :$param })(42) 23:36
camelia :param(42)
ab5tract This works also for if
m: my %h = :k(‘v’); if %h<k> -> $value { dd :$value } 23:38
camelia :value("v")
ab5tract Or anywhere that a block can fit 23:39
The reason the react block doesn’t get any data is because you have to call start on the proc sync object 23:43
You can have this happen in your react block or assign the start promise into a variable before the react block is defined 23:44
docs.raku.org/type/Proc/Async 23:45
15 Jul 2024
thowe I need more testing but I appear to have a version that can assemble lines as they come in disjointed. 00:34
OK. This is the version using tap that can do line reassembly. feel free to tell me how to be more idomatic. gitlab.com/-/snippets/3728669 00:41
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/07/15/2024-...exprjit-5/ 15:48
19 Jul 2024
AviFS hey there, just testing irc 07:26
20 Jul 2024
thowe What's the best way to pass a list as an argument and have it treated as a list of arguments and not one argument? Using an array works, but now I'm curious what the syntax would be to just pass a list object. 20:34
I guess just adding ".list" works... nm 20:39
antononcube @thowe I think you looking for the so called "flattened slurpy." 21:18
@thowe ... or the "single argument slurpy."
thowe perhaps... 21:20
I was passing a command line to Proc::Async.new() 21:21
trying to figure out a few proof of concept things for sort of a bespoke fail2ban replacement gitlab.com/-/snippets/3728669 21:34
I would want to fire up a bunch of these at the same time... Generate the monitoring/parsing objects from a set of configs. 21:37
22 Jul 2024
ab5tract m: my @a = [1,2], [3,4], [5,6]; sub s($a, $b) { dd [:run(++$), :$a, :$b] }; for @a -> @ap { s(|@ap) } 10:17
camelia [:run(1), :a(1), :b(2)]
[:run(2), :a(3), :b(4)]
[:run(3), :a(5), :b(6)]
ab5tract thowe: ^^
It's a bit more convulated when mixing positional and named argments, however: 10:22
m: my @a = [1,2,:c<a>], [3,4, :c<b>], [5,6, :c<c>]; sub s($a, $b, :$c) { dd [:run(++$), :$a, :$b, :$c] }; for @a -> @ap { s(|@ap[0,1], |%(@ap[2])) }
camelia [:run(1), :a(1), :b(2), :c("a")]
[:run(2), :a(3), :b(4), :c("b")]
[:run(3), :a(5), :b(6), :c("c")]
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/07/22/2024-...e-toolbox/ 19:30
26 Jul 2024
briandouglas_71953 What editor are most people using for raku? 21:57
lizmat many use commaide.com 22:00
briandouglas_71953 Thanks 22:07
antononcube @briandouglas_71953 Depends for what. I write Raku package with Commaide. But this why to "heavy" and "involved". For simple scripts I use Visual Studio Code with Bscan's Raku extension. For research, I use Jupyter notebooks or chatbooks. 22:13
briandouglas_71953 I'm enjoying writing beautiful code with Raku. I came across this which surprised me, whilst writing a DI container. // Precedence issue with ! and :exists, perhaps you meant :!exists? method set(Str $abstract, Callable $factory) { if ! %!bindings{$abstract}:exists { %!bindings{$abstract} = $factory; } } // WORKS method set(Str $abstract, Callable 22:22
$factory) { if %!bindings{$abstract}:!exists { %!bindings{$abstract} = $factory; } }
Nice error message btw
antononcube Consider using LLMs with and for Raku. 22:33
briandouglas_71953 I am, thanks 22:42
I'd appreciate a code review as I'm a newbie, pointers are welcome. Here is a DI container, without autowiring. I'll tackle reflection tomorrow. gist.github.com/BrianDouglasIE/0b1...63213cff5e 23:05
27 Jul 2024
vendethiel You can use not for a low-priority alternative 00:00
Adverb binding is not obvious 00:01