🦋 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. |
|||
00:05
[Coke] left
00:06
reportable6 left
00:08
[Coke] joined
00:09
reportable6 joined
01:07
frost joined
02:02
nine left,
nine joined
02:14
ToddAndMargo joined
|
|||
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 | ||
02:35
ToddAndMargo left
04:02
Sankalp left
04:04
Sankalp joined
04:12
oodani left
04:13
oodani joined
04:48
xinming left
04:50
xinming joined
05:38
mexen joined
05:39
jujo joined
|
|||
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 | ||
06:07
reportable6 left
06:10
reportable6 joined
06:32
Sgeo left
|
|||
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 | |
06:47
daxim left
|
|||
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 | |||
06:54
defaultxr left
06:55
defaultxr joined
|
|||
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 $_ | |||
07:00
daxim joined
|
|||
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 | ||
08:00
linkable6 left,
evalable6 left
08:01
evalable6 joined
08:02
linkable6 joined
08:03
grondilu joined
|
|||
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 | |
08:47
jujo left
09:07
grondilu left
09:29
frost left
|
|||
Geth | ecosystem: 591f91b7d8 | (Elizabeth Mattijsen)++ | META.list Fix URL for pbkdf2 |
09:32 | |
09:36
grondilu joined
09:47
jaguart joined
10:47
reportable6 left,
unicodable6 left,
quotable6 left,
greppable6 left,
releasable6 left,
tellable6 left,
statisfiable6 left,
linkable6 left,
evalable6 left,
benchable6 left,
notable6 left,
bloatable6 left,
coverable6 left,
nativecallable6 left,
shareable6 left,
committable6 left,
bisectable6 left,
sourceable6 left
10:48
reportable6 joined,
shareable6 joined,
nativecallable6 joined,
notable6 joined,
statisfiable6 joined,
sourceable6 joined,
committable6 joined
10:49
unicodable6 joined,
benchable6 joined,
evalable6 joined,
bloatable6 joined,
tellable6 joined,
bisectable6 joined
10:50
coverable6 joined,
linkable6 joined,
releasable6 joined,
greppable6 joined,
quotable6 joined
11:10
guifa left
|
|||
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 |
|||
11:33
solitario left
11:46
solitario joined
11:55
melezhik joined,
melezhik left
|
|||
Geth | doc/document-are: c7375b3ba9 | (Elizabeth Mattijsen)++ | doc/Type/Any.pod6 Tweak, Altai-man++ |
12:06 | |
12:07
reportable6 left,
reportable6 joined
|
|||
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 | ||
12:18
frost joined
12:21
melezhik joined
|
|||
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 | ||
12:25
melezhik left
12:26
Nemokosch joined
|
|||
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 | ||
12:27
Nemokosch left
|
|||
I used the produce meta-operator with the comma operator | 12:27 | ||
12:37
Sankalp left
12:39
Sankalp joined
12:46
guifa joined
12:51
jaguart left
12:56
guifa left
13:12
jaguart joined
|
|||
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 | |
14:12
linkable6 left,
evalable6 left,
linkable6 joined
14:13
Sankalp left
14:14
Sankalp joined
14:15
evalable6 joined
14:19
perlbot left
14:20
perlbot joined
14:21
simcop2387 left
|
|||
Nemokosch | I took this from Jan Krňávek 😄 | 14:21 | |
a cool prototyping feature, you need less parens and all | 14:22 | ||
14:23
simcop2387 joined
14:28
Sgeo joined
14:48
bigdata joined
15:01
frost left
|
|||
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 | |
15:20
frost joined
15:22
grondilu left
15:23
bigdata left
15:24
jaguart left
|
|||
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 | ||
15:44
frost left
15:46
Sankalp- joined
15:47
Sankalp left,
Sankalp- is now known as Sankalp
15:49
bigdata joined
|
|||
Nemokosch | well yeah that's not transparent | 15:50 | |
15:55
razetime joined
16:03
guifa joined
16:12
bigdata left
16:41
grondilu joined
|
|||
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. | |||
16:45
jujo joined
|
|||
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 | ||
17:06
bigdata joined
17:07
razetime left
|
|||
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 | ||
17:47
mexen left,
jujo left
|
|||
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 | ||
18:08
reportable6 left,
[Coke] left,
reportable6 joined
18:19
Guest35 joined
18:20
[Coke] joined
|
|||
guifa | weird | 18:30 | |
the best place to look at how some of RakuAST works is the test files for Rakudo | |||
18:37
melezhik joined
|
|||
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 | |
19:00
silug left
|
|||
melezhik | github.com/melezhik/sparkyci/issues/1 | 19:00 | |
19:03
melezhik left
19:07
silug joined
20:07
evalable6 left,
linkable6 left,
linkable6 joined
20:10
evalable6 joined
20:17
grondilu left
21:01
bigdata left
21:13
guifa left
21:14
perlbot left,
simcop2387 left
21:15
perlbot joined
21:16
simcop2387 joined
21:23
dg left
|
|||
gfldex .oO( In Raku, we don't need to LEAVE a mess behind. ) | 21:46 | ||
22:23
linkable6 left,
evalable6 left,
evalable6 joined
22:25
linkable6 joined
22:32
swaggboi left
22:45
swaggboi joined
23:45
unicodable6 left,
quotable6 left,
coverable6 left,
benchable6 left,
releasable6 left,
committable6 left,
greppable6 left,
bloatable6 left,
bisectable6 left,
sourceable6 left,
reportable6 left,
evalable6 left,
tellable6 left,
statisfiable6 left,
nativecallable6 left,
notable6 left,
linkable6 left,
shareable6 left,
tellable6 joined,
nativecallable6 joined
23:46
releasable6 joined,
reportable6 joined,
coverable6 joined,
shareable6 joined
23:47
evalable6 joined,
bisectable6 joined,
greppable6 joined,
benchable6 joined,
statisfiable6 joined,
unicodable6 joined
23:48
linkable6 joined,
committable6 joined,
quotable6 joined,
bloatable6 joined,
sourceable6 joined,
notable6 joined
|