🦋 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 inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
ToddAndMargo Hi All,  RakudoMoar-2022.04.01-win-x86_64-msvc.msi.  Is "spurt" suppose to overwrite?  That is my understanding.  I have an instance writing to Ice drive where if the data is identical to what is already there, spurt appends, so I get doubles.  But is the data changes, it overwrites 02:16
tellable6 2021-07-13T03:53:00Z #raku-dev <Xliff> .tell ToddAndMargo class AA { has Str @.I is rw; submethod BUILD (:$data) { @!I[.key] = .value for $data.pairs }; method new(*%data) { self.bless( :data => %data ); }; }; AA.new(66 => 23, 10 => 1, 100 => 'a').gist.say;
hey ToddAndMargo, you have a message: gist.github.com/52bb07a5170aeeefe9...93bbcec69a
moon-child ToddAndMargo: ix.io/3Wx9 does not happen for me. Though I am not on windows, and I am not sure what ice drive is 02:19
1) does that simple example reproduce for you? 2) does it still happen without ice drive? 02:20
ToddAndMargo icedrive.net/
moon-child (and if the answer to 2 is no, it may be a flaw in ice drive; I would suggest testing this with a small c snippet) 02:21
ToddAndMargo teh example works perfectly on both Linux and Windows 10. This is an Ice Drive issue.  Thank you for the double check! 02:23
I also notices that I had to run my program twice to get the file to see more than zero bytes.  Ice Drive has some bugs.  The double entry problem won't be an issue as the program triggers every hour and the date in the time data will change 02:27
jujo hello 05:39
I need help with a raku oneliner, anyone could give me a hand?
moon-child jujo: if you have a questino, then ask it 05:46
jujo I want to use somehthing like this 05:55
> cat file | raku -ne '.match(/begin <(content)> end/, :g).map({.Str.say})' 05:56
to print only the contents between begin and end
oh just figured it out 06:06
I just needed to stop my patterns from being greedy 06:07
jujo is there a way to lets say, if I pipe the contents of a file to raku 06:42
to run the command not per line, but with the contents as a whole
?
moon-child | raku -e 'do whatever with slurp'
jujo thanks, sorry to bother, but how should I use slurp in there? 06:46
moon-child slurp is a function. When you call it with a filename, it returns a str representing the entire contents of the file. When you call it with no arguments, it uses stdin as a defualt 06:47
jujo oh I see 06:47
ok ok
doing
raku -e "slurp.say"
just prints the same input it received
thanks again, think I got it
jujo yet another question... 06:57
I have: cat fak | raku -e "slurp.match(/'?p=' <( <-[\"]>+/,:g)"
it works well
but I want to apply an anonymous function to every item 06:58
like substract one
what, I did 07:00
raku -e "slurp.match(/'?p=' <( <-[\"]>+/,:g).map({ .Int + 1}).say"
I expected the magic bind to be $_
moon-child you can use $_ there 07:01
I expect most would write that as ...map(* + 1), using the whatever star 07:02
alternately, { $_ + 1 }
it's not necessary to explicitly call .Int unless you specifically need to truncate a float or rat, as + will coerce a string to a number automatically
jujo when I use $_ or * it errors out 07:03
saying something about if I was meaning to use floor
moon-child since you are using double quotes at the shell level, you would need to escape the $ in $_ 07:04
if you use *, then you need to skip the braces
jujo :O
one last question, if my pipeline ends up producing a single value, and I want to apply a lambda to it 07:06
how should I do it
moon-child why do you need to create a lambda abstraction? Just do whatever the function would have done directly 07:07
jujo I want to create a range, if I got 3, I want a range like 0..3 07:08
oh
jmmm 07:09
i thought that doing 0..(all of that)
would work
El_Che m: say 0...3 07:15
camelia (0 1 2 3)
jujo thanks, but I need to do it from a command line one liner 07:17
where I have a value that result from processing a file
I'm here so far 07:18
cat fak | raku -e "slurp.match(/'?p=' <( <-[\"]>+/,:g).map( * - 1 ).max <I want to use max to create a range>"
well 07:21
I did it
cat fak | raku -e "slurp.match(/'?p=' <( <-[\"]>+/,:g).max.&({0..\$_-1}).Seq.say" 07:22
but I wonder if there is another way
moon-child in place of 0..x, you can say 0..^x 07:24
or just ^x, for short 07:25
err, in place of 0..(x-1), say 0..^x
jujo I see 07:30
wow, didn't know how powerful where raku one liners
its like haskell but practical and with predictable magic 07:32
jujo thank you so much, good night 08:12
grondilu m: say .fmt("%08x") given my int32 $ = -1 08:16
camelia 000000-1
grondilu 🤨 08:19
Geth ecosystem: 591f91b7d8 | (Elizabeth Mattijsen)++ | META.list
Fix URL for pbkdf2
09:32
Geth doc/document-are: c8f331765f | (Elizabeth Mattijsen)++ | doc/Type/Any.pod6
Document the .are method
11:17
doc: lizmat++ created pull request #4069:
Document the .are method
Geth doc/document-are: c7375b3ba9 | (Elizabeth Mattijsen)++ | doc/Type/Any.pod6
Tweak, Altai-man++
12:06
grondilu m: dd my @ = [ [ "foo" ] ]; dd my @ = [ [ "foo" ], ]; 12:08
camelia Array @ = ["foo"]
Array @ = [["foo"],]
grondilu isn't it kind of non-intuitive? 12:09
Nemokosch I think this is actually fair and conform with rather explicit design choices 12:10
the comma makes the structure, not the brackets
I think this is explicitly recited as an example somewhere
in fact you don't even need the outer brackets 12:12
m: dd my @ = [ "foo" ] , ;
the latter is because of something that I for one dislike: the so-called "list assignment" 12:14
the @ sigil on the LHS of an assignment means: empty the container, take all the elements from the RHS and put them into the container 12:16
grondilu noted 12:22
Geth ecosystem: 499a334153 | (Elizabeth Mattijsen)++ | META.list
Remove DB::Model::Easy from git ecosystem

It only ever had one release, and with the existence of Red, it feels that nobody will be interested in picking up this distribution and continue to develop this.
The only known release will continue to live in the REA.
12:24
Nemokosch but yes, the comma itself is a list-maker operator, no matter the sigil
to demonstrate that, let me generate increasing number sequences starting from one 12:25
Nemokosch m: [\,] (1..^10) andthen .raku.say; 12:26
camelia ((1,), (1, 2), (1, 2, 3), (1, 2, 3, 4), (1, 2, 3, 4, 5), (1, 2, 3, 4, 5, 6), (1, 2, 3, 4, 5, 6, 7), (1, 2, 3, 4, 5, 6, 7, 8), (1, 2, 3, 4, 5, 6, 7, 8, 9)).Seq
Nemokosch maybe from the irc
dang 12:27
I used the produce meta-operator with the comma operator 12:27
Geth doc/document-are: 8b4d2bfb9a | (Elizabeth Mattijsen)++ | doc/Type/Any.pod6
More sses
13:19
grondilu `andthen` is something I never use. Maybe I should. 14:11
Nemokosch I took this from Jan Krňávek 😄 14:21
a cool prototyping feature, you need less parens and all 14:22
Voldenet m: sub x($_) { .return }; x(2).say 15:09
camelia 2
Nemokosch _why_ 15:14
Voldenet heh heh 15:15
watch this
m: use nqp; sub surprise() { nqp::throwpayloadlexcaller(nqp::const::CONTROL_RETURN, 2) }; sub x { surprise(); return 3; }; x().say
camelia 2
Nemokosch okay, this is cheating 15:17
Voldenet but hold my beer, it's not the end
m: use nqp; sub surprise() { nqp::throwpayloadlexcaller(nqp::const::CONTROL_RETURN, 2) }; sub x { surprise() }; x().say
camelia Attempt to return outside of any Routine
in sub surprise at <tmp> line 1
in sub x at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet I love those tiny little surprises
Nemokosch anyway, using $_ as a parameter is an interesting idea 15:18
why did it fail though 15:19
Voldenet obviously, x wasn't supposed to return anything! :) 15:20
Nemokosch but like, who decided that it wasn't 15:24
Voldenet m: use nqp; sub surprise is hidden-from-backtrace { nqp::throwpayloadlexcaller(nqp::const::CONTROL_RETURN, 2) }; sub x { surprise() }; x().say 15:25
camelia Attempt to return outside of any Routine
in sub x at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet handler for CX::Return is missing 15:29
and it's moarvm deciding that 15:32
Nemokosch well yeah that's not transparent 15:50
grondilu I may have bitten off more than I can chew with this protobuff thing I'm trying to do. 16:43
github.com/grondilu/protobuf-raku
the thing is, I'm supposed to generate code. And not just subs, but classes.
I could try to use the metamodel, but that sounds complicated. 16:44
I could write some actual raku code in plain text, save it in a file in RAKULIB path, and then load it.
grondilu possibly doing all this code generation into a BEGIN block so that the generated code can be used by the rest of the code as if it had been there from the beginning. 16:46
All this sounds overkill, though.
Last time I had to do code generation was with my clifford module. 16:47
github.com/grondilu/clifford
but then I ended up just using closures, which was quite simple and elegant. 16:48
I'm hoping I could do that again, but I don't quite see the way to do it.
guifa grondilu you'll probably not like the answer, but you'll probably want to hold off for RakuAST (or start experimenting it some) 16:53
grondilu never heard of it 16:57
is that about macros?
anyway the more I think about it, the more I am tempted to write the module in raku on disk inside a BEGIN block 16:58
I can't show it here as there is IO involved, but I've just tried `BEGIN "lib/foo.rakumod".IO.spurt: "unit module foo;"; use foo;` and it does work.
guifa RakuAST lets you generate Raku code without needing to EVAL Str which is always risky 17:00
grondilu actually I can even put the use statement before the BEGIN block, which is nice.
guifa: yeah I wouldn't be satisfied with resorting to EVAL 17:01
grondilu I don't like having to write to disk either though, as that would leave some mess to clean up afterwards. 17:11
although I suppose I could remove the files in a END block. 17:12
Voldenet but how is using files different from EVAL 17:39
it carries all the nasty stuff that makes EVAL problematic in the first place 17:40
grondilu Voldenet: true 17:49
well that is weird 18:02
I was watching jnnth's conference about rakuAST... 18:03
at some point he talks about `--target=ast`
so I give it a try for fun
I run `raku --target=ast -e 'say "hi";'` 18:04
and since the output is large, I re-run it with `|most`, as one does.
and then I got an unresponsive terminal :/ 18:05
not even ctrl-C was caught
such output is not supposed to contain control characters though, does it/ 18:06
damn even `|cat -v |most` misbehaves 18:07
guifa weird 18:30
the best place to look at how some of RakuAST works is the test files for Rakudo
melezhik .tell patrickb you can use use this to make SparkyCI output more readable when dealing with stderr mixed with stdout - git.sr.ht/~melezhik/Devel-ExecRunn...d70f.patch 18:38
tellable6 melezhik, I'll pass your message to patrickb
patrickb melezhik: Thanks! 18:43
tellable6 2022-04-25T23:10:37Z #raku <melezhik> patrickb I've added support for any git urls, not just GH - sparrowhub.io:2222/report/232
2022-04-27T18:13:22Z #raku <melezhik> patrickb I successfully run your build from my fork - git.sr.ht/~melezhik/Devel-ExecRunn...rkyci.yaml
2022-04-27T18:28:36Z #raku <melezhik> patrickb - here Devel-ExecRunnerGenerator SpakyCI log with debug enabled for `build.pre` hook - sparrowhub.io:2222/report/263
2022-04-27T20:03:43Z #raku <melezhik> patrickb , please see github.com/melezhik/sparkyci/blob/...uild-hooks as well
patrickb melezhik: I'm really impressed with SparkyCI. It really is very little effort to get it up and running. 18:44
melezhik: How hard would it be to get a "My builds" tab? 18:46
melezhik patrickb - thanks! I am glad someone find the service useful. "my builds" would not be that hard, will add it to my todo list 18:57
tellable6 2022-04-28T23:09:30Z #raku <SmokeMachine> melezhik: still working on that…
melezhik "it really is very little effort to get it up and running." - thanks again ... yeah, that was the intention - to make it as simple as possible for end users, and it still extendable via `.sparky.yaml` if needed ... 18:58
melezhik github.com/melezhik/sparkyci/issues/1 19:00
gfldex .oO( In Raku, we don't need to LEAVE a mess behind. ) 21:46