🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). 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 6 September 2022.
00:00 Voldenet left, jast left, polettix left, sjn left, KotH left, charsbar left, JRaspass left, lucs left, dac left, maettu left, lucs_ joined, KotH joined, maettu joined, charsbar joined, sjn joined, polettix joined, jast joined, reportable6 left 00:01 JRaspass joined 00:02 reportable6 joined, Voldenet joined 00:03 habere-et-disper left 00:04 dcx joined 00:06 coleman left, coleman joined 00:11 Nemokosch left 00:12 Nemokosch joined 00:18 lichtkind left 00:23 grondilu left 00:24 coleman left, coleman joined 00:29 coleman left 00:33 jpn left 00:43 coleman joined 00:53 Nemokosch left 01:00 jpn joined 01:03 xinming left 01:05 xinming joined 01:09 coleman left, coleman joined 01:13 coleman left 01:17 xinming left, xinming joined 01:42 Kaiepi left 01:45 jpn left 02:12 jpn joined 02:25 jpn left 02:51 jpn joined 02:57 razetime joined 02:58 jpn left
[Coke] this used to work: a 'proto sub MAIN() { ...; {*} }; in a module and a sub MAIN() { ... } in a script. (from some adventofcode helper scripts I had last year that now don't work) 03:10
03:12 jpn joined
[Coke] m: proto MAIN(|) { say "proto"; {*} }; multi MAIN() { say "hi"; } 03:14
camelia proto
hi
[Coke] seems happy enough in a single script 03:15
any thoughts appreciated
tonyo what -v 03:23
03:24 jaguart joined
[Coke] 2022.07 03:30
ugexe hmm, i always thought only the first MAINline gets run 03:33
but that might be if you have two MAINs in different modules only one of them gets used 03:34
[Coke] ... there has beem a very annoying change on my osx 12.6 box; if I highlight text, ther is no highlight color until I stop the selection. then it highlights. any way to get this back to highlight-as-you-go greatly appreciated.
03:41 jaguart left, jaguart joined 03:53 lesihctej left 03:57 jetchisel joined 04:05 grondilu joined
grondilu check this out, basically RIPEMD-160 as a FP one-liner : github.com/grondilu/libdigest-raku...MD.rakumod 04:05
it's also the fastest version I wrote to date 04:06
04:06 jpn left
grondilu "one-liner" being a figure of speech here ;) 04:07
still, no variable here. Like, there is no C<my>. 04:09
grondilu considers creating a 'constrained programming' contest and grant himself the first prize 😄 04:13
04:19 jpn joined
[Coke] ... rebooting fixed my #$%^&* trackpad issues. 04:21
04:25 jpn left 04:26 grondilu left 04:34 Kaiepi joined
MasterDuke that's certainly something...i like it, but am not sure that i like that i like it 04:38
04:39 jpn joined 04:46 MasterDuke left 04:53 squashable6 left 04:54 squashable6 joined 05:03 jpn left 05:12 coleman joined 05:14 jpn joined 05:19 jpn left 05:32 jpn joined 05:38 jpn left 05:56 jpn joined 06:00 reportable6 left 06:02 reportable6 joined 06:15 jpn left 06:42 grondilu joined
grondilu m: class { has $.x; multi method new { samewith rand }; multi method new(Num $x) { samewith 06:42
camelia ===SORRY!=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> d }; multi method new(Num $x) { samewith⏏<EOL>
expecting any of:
statement end
statement modifier
statement modifier loo…
grondilu m: class { has $.x; multi method new { samewith rand }; multi method new(Num $x) { samewith :$x } }.new
^I'm not quite sure why this hangs
camelia (timeout) 06:43
grondilu I think I've used that kind of scheme before, a constructor with no parameters to set a random attribute.
For some reason I can't make it work anymore. 06:44
unless I use bless or something but really I shouldn't have to, should I?
m: say class { has $.x; multi method new { samewith rand }; multi method new(Num $x) { self.bless: :$x } }.new.x 06:45
camelia 0.1505676333858187
06:54 TheVirginian joined 06:55 TheVirginian left 06:57 jpn joined 07:57 greppable6 left, sourceable6 left, tellable6 left, coverable6 left, notable6 left, bloatable6 left, committable6 left, statisfiable6 left, shareable6 left, benchable6 left, releasable6 left, bisectable6 left, unicodable6 left, reportable6 left, nativecallable6 left, evalable6 left, linkable6 left, squashable6 left, quotable6 left, squashable6 joined, quotable6 joined, bloatable6 joined, committable6 joined 07:58 linkable6 joined, sourceable6 joined, shareable6 joined, greppable6 joined, benchable6 joined, evalable6 joined, releasable6 joined 07:59 statisfiable6 joined, bisectable6 joined, notable6 joined, reportable6 joined, coverable6 joined 08:00 nativecallable6 joined, unicodable6 joined 08:02 tellable6 joined 08:17 abraxxa joined 08:36 jpn left 08:42 lichtkind joined 08:46 Sgeo left 09:09 dakkar joined 09:11 Nemokosch joined 09:20 sena_kun joined
Nemokosch Guys, what do you think 1 ~~ @foo should return on a lazy list? 09:26
09:37 Nemokosch left 09:49 jaguart left, jpn joined, jaguart joined
lizmat although I'm not one of the guys, I'd say: no 10:09
Nemokosch You mean _False_? 10:11
github.com/rakudo/rakudo/issues/2468 for context
lizmat the "no" was on the question whether it should return a lazy list 10:12
Nemokosch Sorry but that wasn't the question. "*what* do you think (...) should return *on* a lazy list" 10:15
10:17 grondilu left 10:19 grondilu joined 10:29 epony left 10:35 holyghost joined 10:39 holyghost left 10:53 mscha joined
mscha m: my %h; say 'yes' if %h<a>:exists && %h<b>:exists; 10:53
camelia ===SORRY!=== Error while compiling <tmp>
You can't adverb &infix:<&&>
at <tmp>:1
------> ay 'yes' if %h<a>:exists && %h<b>:exists⏏;
expecting any of:
pair value
mscha m: my %h; say 'yes' if %h<a>:exists and %h<b>:exists; 10:54
camelia ( no output )
mscha m: my %h; say 'yes' if (%h<a>:exists) && (%h<b>:exists);
camelia ( no output )
mscha Does && really bind tighter than :exists??
Nemokosch this seems to be characteristic of adverbs... I still don't know where they go exactly 11:05
design.raku.org/S03.html#Adverbs 11:11
I'd expect that this holds to this day
lizmat yeah, I've heard stories about how difficult it was to get adverbs to work 11:12
11:21 habere-et-disper joined
grondilu I tried very naively to create a NativeCall to openssl's digest : gist.github.com/grondilu/e5d11be7b...119631c805 11:42
oh wait I thought it wasn't working but maybe it does 11:43
it was printing just "NativeCall::Types::CArray[uint8].new"
I thought that was just an empty array but when I coerce it to Str I get some numbers 11:44
oh yes it does work, I get the good hash. Pretty neat. 11:46
12:00 reportable6 left 12:02 reportable6 joined 12:04 epony joined 12:30 razetime left
Anton Antonov I wonder how many Rakunistas use Jupyter (with Raku or other language.) Any comments on this? (Or confessions.) 12:38
12:43 jpn left
lizmat confesses nothing :) 12:49
Anton Antonov @lizmat I see. 🙂 I know some Rakuns have hard time putting vi down. That might be more confessable... 12:56
lizmat to that I will confess :-)
13:06 grondilu left 13:08 habere-et-disper left 13:49 jpn joined
mscha m:  say '[[8,7,6]]'.EVAL # Bug or feature? 13:54
camelia [8 7 6]
13:54 lichtkind left
mscha m: say '[[8,7,6],]'.EVAL # I know, this works, but that's not the data I have - adventofcode.com/2022/day/13 13:54
camelia [[8 7 6]]
13:54 lichtkind joined
Nemokosch [[asd]] is the same as [asd] 13:56
I'm not sure what's the principle behind it since the square bracket is pretty much dedicated to these literals
mscha Too bad, no `.EVAL`-based solution for today's Advent of Code then... 13:57
Luckily, it's also valid JSON, and JSON _does_ do the right thing with [[8,7,6]].  :-) 14:03
14:08 mcmillhj joined
Nemokosch so basically JS does 😛 14:09
in fact, it seems you can build whole convoluted structures that still give you an empty array 14:15
[[()[]]] - look at this boi 14:16
jast beautiful
14:19 mscha left
Geth doc: tbrowder++ created pull request #4168:
Improve discussion and examples of programmatically using class method names
14:36
doc: 1d41f3822b | (Will Coleda)++ | xt/aspell.t
use higher level Lock

  tbrowder++, part of #4162
14:37 linkable6 left 14:38 linkable6 joined
Geth doc: a0f57177eb | (Will Coleda)++ | 2 files
use higher level Lock

  tbrowder++, part of #4162
14:49
hobbified I didn't think of going via JSON, I just wrote a parser. Which wasn't awful :)
14:50 linkable6 left 14:52 linkable6 joined
Nemokosch Seems this year is a lot about parsing 😄 14:59
once again I'd like to remind yall of this supposed AoC collection github.com/codesections/advent-of-raku-2022 15:00
I don't think I could dive into this before this weekend 15:01
15:23 xinming left, mscha joined, xinming joined
mscha I used a grammar at first: github.com/mscha/aoc/blob/master/aoc2022/aoc13b 15:24
Then I saw a Perl solution which used eval and though: nice trick, I'm sure Raku can do that as well.  Not... 15:25
My JSON-based solution: github.com/mscha/aoc/blob/master/aoc2022/aoc13b
15:25 Sgeo joined
mscha I used a grammar at first: correct link github.com/mscha/aoc/blob/master/aoc2022/aoc13 15:27
15:29 xinming left 15:30 xinming joined
mcmillhj What's the correct way to iterate through an array in pairs in Raku? I was trying `for @d -> ($l, $r) { dd [$l, $r]; }` but that isn't quite right 15:32
tellable6 2022-01-04T08:50:00Z #raku <SmokeMachine> .tell mcmillhj it seems you’ve just missed the sigil… (glot.io/snippets/g5scg1bf5l)
Nemokosch wow 🤣
mcmillhj: can you give an example of what @d would contain? 15:33
mcmillhj yep, sorry.
m: my @d = [[1], [2], [3], [4]]; for @d -> (@l, @r) { dd [@l, @r]; }
camelia Type check failed in binding to parameter '@l'; expected Positional but got Int (1)
in block <unit> at <tmp> line 1
mcmillhj shoot, sorry 1 sec
m: my @d = [[1], [2], [3], [4]]; for @d -> ($l, $r) { dd [$l, $r]; } 15:34
camelia Too few positionals passed to '<anon>'; expected 2 arguments but got 1 in sub-signature
in block <unit> at <tmp> line 1
dutchie m: my @d = [[1], [2], [3], [4]]; for @d -> $l, $r { dd [$l, $r]; } 15:36
camelia [[1], [2]]
[[3], [4]]
mcmillhj oh, what does wrapping `$l` and `$r` in `()` tell to the compiler. I must not quite understand that.
dutchie `-> ($l, $r) {}` takes one argument and deconstructs it
mcmillhj ahh, okay. thank you dutchie. 15:37
mscha m: my @d = [[1], [2], [3], [4]]; for @d.rotor(2) -> ($l, $r) { dd [$l, $r]; } # works as well
camelia [[1], [2]]
[[3], [4]]
dutchie docs.raku.org/type/Signature#Destr..._arguments
Nemokosch I tend to forget that the () is significant there... 15:38
15:39 NemokoschKiwi joined
NemokoschKiwi m: my @d = [[1], [2], [3], [4]]; for @d -> @l, @r { dd [@l, @r]; } 15:39
camelia [[1], [2]]
[[3], [4]]
NemokoschKiwi epicc
15:40 NemokoschKiwi left 15:42 xinming left, xinming joined 15:44 abraxxa left
mcmillhj m: my @L = [[]]; @L; 15:50
camelia WARNINGS for <tmp>:
Useless use of @L in sink context (line 1)
mcmillhj m: my @L = [[]]; dd @L;
camelia Array @L = []
mcmillhj ^ how come `@L` gets collapsed here? The inner empty Array is removed.
Nemokosch very good question, just got mentioned like 2 hours ago 15:52
mcmillhj probably by someone else doing aoc :) I can check the logs
Nemokosch if I were to guess, [] doesn't say "put this inside an array" but "store this as an array" 15:53
I'm afraid this should be checked on the syntax level, unless you are lucky to pinpoint it somewhere in the docs
mscha "someone else doing aoc", yup, me.  :-) 15:54
Final version I'm happy with: github.com/mscha/aoc/blob/master/aoc2022/aoc13b
Nemokosch docs.raku.org/routine/[%20]
luck might be on our side today - this is just an operator 15:55
mcmillhj Oh okay, I initially did today's problem in JS because the input was valid JSON. Was trying to clean it up in Raku. I did a similar multi sub compare but wasn't zipping the two lists together. 15:56
Nemokosch 😂 15:58
mscha The input is also valid Perl with `eval`, but not Raku with `.EVAL`.  Well, it's valid Raku, but it collapses arrays with one element, that's why this came up before.
Nemokosch lately, I've been addicted to this module that helps you look up source code in the compiler 15:59
so here we go: github.com/rakudo/rakudo/blob/704a...rs.pm6#L13
the very line that gets triggered
Array.from-list([]) gives []
the source also hints that [$[]] would indeed be an array inside an array 16:02
16:11 Xliff joined
Xliff Hi ho! 16:11
tellable6 2022-12-09T20:03:16Z #raku <guifa> Xliff: you can override it by wrapping it
Xliff Congrats on the release of RakuAST to main: nine++, vrurg++
However, can someone tell me why this isn't working?
RAKUDO_RAKUAST=1 raku call.t
vrurg Xliff: do you take into account that RakuAST is far from being complete yet? 16:12
Xliff Yes. 16:13
However the tests should be working, yes?
Is that the correct way to invoke a RAKUAST enabled program? 16:14
And that is t/12-rakuast/call.t -- I thought that one WAS working?
mcmillhj mscha what does the `?*` passed to `.first(?*)` mean in your solution? 16:22
mscha First one with a true value.
Values are Less, Same, More.  More == 0, so ?More = False
Nemokosch bool conversion?
16:22 Tirifto left
mscha `first(*)` probably works as well. 16:23
Nemokosch you mean, Same == 0
mscha Yes, sorry, Same == 0, so ?Same == False
mcmillhj oh okay, that means the same thing as `.first(* != Same)` right? 16:24
16:24 Tirifto joined
mscha Yes 16:26
That might indeed be the cleanest way to do that 16:27
smol-hors hi 16:35
vrurg Xliff: don't remember right now about call.t. I think it should. But either way, we're not done with post-merge procedures yet, so let it stabilize first.
vrurg is afk
16:37 epony left
Xliff vrurg: Sure thing. How long do you estimate that will be? 16:38
lizmat clickbaits rakudoweekly.blog/2022/12/12/2022-50-mainified/ 16:39
smol-hors aoc day 13 github.com/esnk86/aoc22/blob/main/13/main.raku 16:40
my correct-order function could have been better, but eh ;p
mscha: looks like we had a similar thought process 16:42
16:43 xinming left
mscha Yes, although it took me quite a while to get there.  :-) 16:43
smol-hors day 12 took me ages
16:44 xinming joined
hobbified my @packets = lines.grep(*.chars > 0).map(*.EVAL).List; that shouldn't work though :) 16:52
mscha Problem with .EVAL: 16:53
m: dd '[[[[1]]]]'.EVAL
camelia [1]
mscha But I guess that doesn't actually make a difference for the answer. 16:54
m: use JSON::Fast; dd from-json('[[[[1]]]]'); 16:55
camelia ===SORRY!=== Error while compiling <tmp>
Could not find JSON::Fast in:
/home/camelia/.raku
/home/camelia/rakudo-m-inst-1/share/perl6/site
/home/camelia/rakudo-m-inst-1/share/perl6/vendor
/home/camelia/rakudo-m-inst-1/sh…
mscha Oh well.  But that does work.
17:18 epony joined 17:21 spacekookie left 17:22 spacekookie joined 17:28 jpn left
Nemokosch okay but the bot doesn't have JSON::Fast installed 🙂 17:28
ugexe m: dd from-json('[[[[1]]]]'); 17:31
camelia Array @result = [[[[1],],],]
Saw 1 occurrence of deprecated code.
================================================================================
Sub from-json (from GLOBAL) seen at:
<tmp>, line 1
Please use JSON::Fast, JSON::Tiny or JSON…
17:33 jpn joined 17:34 dakkar left 17:43 epony left 17:49 epony joined 17:50 greaser|q joined 17:53 elcaro_ joined, silug5 joined, daxim_ joined 17:54 coleman_ joined, kawaii__ joined 17:55 GreaseMonkey left, linkable6 left, kawaii_ left, daxim left, thowe left, elcaro left, coleman left, silug left, coleman_ is now known as coleman, kawaii__ is now known as kawaii_, silug5 is now known as silug, thowe joined 17:56 linkable6 joined 18:00 reportable6 left 18:01 jpn left 18:02 reportable6 joined 18:03 rf joined 18:07 jpn joined 18:11 jpn left
tonyo lizmat: does the wordpress have linkbacks ? 18:15
lizmat think it does, yes
tonyo can you add one so we don't get flagged for the post today? 18:16
should be deathbykeystroke.com/articles/2022...-raku.html
jj gave me authorship but i can't seem to edit that post
lizmat authorship on WP ? 18:17
do you have a WP login? 18:18
tonyo386 ? 18:19
tonyo ^^
tonyo yea 18:34
that's me
18:35 jpn joined 18:37 mcmillhj left
lizmat tonyo: you're the author now 18:47
rf Hey folks! Are there any Raku books that people recommend to get started with? I've been using Raku for about a month but i'd like to go deeper into it. 19:00
lizmat raku.org/resources/ has a few book suggestions 19:03
rf Thanks! 19:08
19:20 sena_kun left 19:21 Xliff left 19:32 sena_kun joined 19:49 sena_kun left 19:50 sena_kun joined 20:05 greaser|q left, greaser|q joined 20:06 greaser|q is now known as GreaseMonkey
tonyo lizmat: ty 20:07
vrurg .tell Xliff make use you have rakudo correctly installed. call.t passes for me. 20:09
tellable6 vrurg, I'll pass your message to Xliff
20:11 jpn left 20:30 n1to joined 20:38 mscha left 20:50 n1to left 20:51 mcmillhj joined
mcmillhj @mscha This is how my day13 turned out: github.com/mcmillhj/aoc/blob/main/...gnal.raku. I updated my Array -> Array comparison to use your zip solution since it looked a lot cleaner. Main difference is `multi` subs for compare. 20:54
vrurg .tell Xliff Correction. For test to work with RAKUDO_RAKUAST env RakuAST must fully or nearly fully complete which is far the case. Tests in 12-rakuast are for already implemented nodes only. 20:59
tellable6 vrurg, I'll pass your message to Xliff
hobbified oh, that's smart 21:03
(using multi sub instead of a big type switch) 21:05
Geth doc: 0rir++ created pull request #4169:
Consolidate once from statement-prefixes.pod6 into control.pod6.
21:07
doc: 0rir++ created pull request #4170:
Consolidate start from statement-prefixes.pod6 into control.pod6.
21:08
doc: 0rir++ created pull request #4171:
Consolidate start from statement-prefixes.pod6 to control.pod6.
21:09
21:11 sena_kun left 22:06 abhinav left 22:07 sena_kun joined 22:13 mcmillhj left 22:50 euandreh left 22:59 euandreh joined 23:28 lichtkind left 23:29 sena_kun left 23:48 Nemokosch joined
Nemokosch bisectable6: say «a bb».raku; 23:48
bisectable6 Nemokosch, Will bisect the whole range automagically because no endpoints were provided, hang tight
Nemokosch, Output on all releases: gist.github.com/1acc5b7889b3af8f89...792874d9fb
Nemokosch, Bisecting by exit code (old=2019.07.1 new=2019.11). Old exit code: 1
Nemokosch, bisect log: gist.github.com/6a25b76c69cf12914e...a25747238d 23:49
Nemokosch, (2019-11-01) github.com/rakudo/rakudo/commit/7c...3c0a81e7ad
Nemokosch, Bisecting by output (old=2017.05 new=2017.06) because on both starting points the exit code is 1
Nemokosch oops
bisectable6 Nemokosch, bisect log: gist.github.com/b26cafc220b44a962e...cb5c3bc71c
Nemokosch, (2017-06-01) github.com/rakudo/rakudo/commit/7c...656b955cd7
Nemokosch, Bisecting by output (old=2016.09 new=2016.10) because on both starting points the exit code is 1
Nemokosch, bisect log: gist.github.com/21d902965bcc028249...b9d51f6e27
Nemokosch, Output on all releases and bisected commits: gist.github.com/aefe8b99dcf9e951fe...b4a5631d72 23:50
Nemokosch bisectable6: dd «a bb»;
bisectable6 Nemokosch, Will bisect the whole range automagically because no endpoints were provided, hang tight
Nemokosch, ¦6c (66 commits): «"a bb"␤»
Nemokosch, Nothing to bisect!
Nemokosch that's... peculiar? 23:51
bisectable6: enum Foo «a b»; say Foo.enums<a>:exists;
bisectable6 Nemokosch, Will bisect the whole range automagically because no endpoints were provided, hang tight
Nemokosch, ¦6c (66 commits): «False␤» 23:52
Nemokosch, Nothing to bisect!
Nemokosch b-but... 23:53
the docs say it's True...
bisectable6: my $a = 42; say << "$a b" c >>.raku; 23:54
bisectable6 Nemokosch, Will bisect the whole range automagically because no endpoints were provided, hang tight
Nemokosch, Output on all releases: gist.github.com/c538dcd87d085bfee9...3f42eb0903 23:55
Nemokosch, Bisecting by exit code (old=2019.07.1 new=2019.11). Old exit code: 1
Nemokosch, bisect log: gist.github.com/e6c40464faf917e728...481ec2e59d
Nemokosch, (2019-11-01) github.com/rakudo/rakudo/commit/7c...3c0a81e7ad
Nemokosch, Bisecting by output (old=2017.05 new=2017.06) because on both starting points the exit code is 1
Nemokosch, bisect log: gist.github.com/fed5764f38156456f8...5d99c73027
Nemokosch, (2017-06-01) github.com/rakudo/rakudo/commit/7c...656b955cd7
Nemokosch, Bisecting by output (old=2016.09 new=2016.10) because on both starting points the exit code is 1 23:56
Nemokosch, bisect log: gist.github.com/8ac89bfc646c588d8f...9e98c2fe26
Nemokosch, Output on all releases and bisected commits: gist.github.com/29836733fe6cd35df3...ee7c7efda4
Nemokosch dayum, the same trap again 23:57
bisectable6: my $a = 42; dd << "$a b" c >>; 23:58
bisectable6 Nemokosch, Will bisect the whole range automagically because no endpoints were provided, hang tight
Nemokosch, ¦6c (66 commits): «("42 b", "c ")␤»
Nemokosch, Nothing to bisect!
Nemokosch also doesn't match the docs! 23:59