🦋 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:02 reportable6 left 00:04 reportable6 joined 00:09 squashable6 left 00:11 squashable6 joined
Geth doc/codesections-eager-sub: 97761a036b | (Daniel Sockwell)++ (committed using GitHub Web editor) | doc/Type/List.pod6
Remove &eager sub form

This removes the &eager sub, which does not seem to exist.
  (There's an .eager method and an eager statement prefix, but no sub)
00:28
doc: codesections++ created pull request #3994:
Remove &eager sub form
00:29
01:01 patrickb left 01:11 japhb left, japhb joined 01:23 gordonfish- is now known as gordonfish 01:25 ProperNoun joined
Geth doc/master: 4 commits pushed by Coke++ 01:30
01:48 kjp left 01:55 Skarsnik left 02:04 ProperNoun left 02:10 ProperNoun joined 02:14 ProperNoun left 02:15 jgaz joined 02:17 ProperNoun joined, monkey_ left 02:20 monkey_ joined
[Coke] ended up avoiding the need for the clone entirely by making the object a tad smarter. 03:16
03:20 evalable6 left, linkable6 left, monkey_ left 03:22 evalable6 joined 03:24 dmc00 joined 03:27 monkey_ joined 04:22 linkable6 joined 05:22 quotable6 left, nativecallable6 left, reportable6 left, sourceable6 left, tellable6 left, committable6 left, shareable6 left, notable6 left, unicodable6 left, linkable6 left, coverable6 left, benchable6 left, evalable6 left, bisectable6 left, releasable6 left, bloatable6 left, greppable6 left, squashable6 left, statisfiable6 left, small_petit joined 05:23 coverable6 joined 05:24 shareable6 joined, reportable6 joined, statisfiable6 joined 05:25 linkable6 joined, nativecallable6 joined, quotable6 joined, evalable6 joined
small_petit I don't know if this is the right place.... Please when is Raku supporting mobile applications? It's just a shame that the language that has got things right does not support android, ios, desktop apps as at now. I just keep getting sad every other day. Thanks. 05:28
05:38 small_petit left 05:40 monkey_ left 06:03 reportable6 left 06:04 frost joined 06:23 notable6 joined 06:24 benchable6 joined, tellable6 joined 06:25 sourceable6 joined 07:03 reportable6 joined 07:23 greppable6 joined 07:25 unicodable6 joined, bisectable6 joined 07:26 squashable6 joined 07:35 seednode left 07:36 seednode joined 07:37 gabiruh_ left, gabiruh joined 07:57 frost left
Geth doc: 7648392313 | (Daniel Sockwell)++ (committed using GitHub Web editor) | doc/Type/List.pod6
Remove &eager sub form (#3994)

This removes the &eager sub, which does not seem to exist.
  (There's an .eager method and an eager statement prefix, but no sub)
08:01
linkable6 Link: docs.raku.org/type/List 08:02
08:02 linkable6 left 08:05 linkable6 joined 08:06 small_petit joined 08:13 small_petit left 08:24 releasable6 joined, committable6 joined 09:01 jgaz left 09:43 silug left 09:44 silug joined 10:24 atroxaper joined
atroxaper Hello, #raku 10:24
m: multi trait_mod:<is>(Mu:D $m, :$name!) {}; class A is name {}
camelia 5===SORRY!5=== Error while compiling <tmp>
'A' cannot inherit from 'name' because it is unknown.
Did you mean 'Same'?

at <tmp>:1
atroxaper How can I write a trait for a class?
10:31 Sgeo left
Nemokosch Hi 10:40
Thanks for codesections for even caring about my complaint with (@a, @b) on the LHS, also vrurg for the answer under the issue I opened for it 10:41
However, to be honest, I'm a bit disappointed by the lack of attention this draws when this behavior is a top 1 WAT candidate in Raku I have seen so ar 10:42
However, to be honest, I'm a bit disappointed by the lack of attention this draws when this behavior is a top 1 WAT candidate in Raku I have seen so far
And so far the arguments have been anything but convincing
If there are other arguments than "it is already common to do in certain situations", please go ahead and say it 10:44
atroxaper Never mind about my question. It's just Mu:U parameter type. 10:48
10:56 atroxaper left 10:58 MoC joined 11:08 jjido joined 11:23 bloatable6 joined 11:26 abraxxa-home joined 11:54 mscha joined
mscha Is there a way to specify a two-dimensional array of Ints, without fixed boundaries? 11:55
E.g.: my Int @foo[*;*] 11:56
m: my Int @foo[*;*]
camelia Jagged array shapes not yet implemented. Sorry.
in block <unit> at <tmp> line 1
mscha I can do simply: my @foo 11:57
lizmat no, not yet, as the message implied :-)
mscha That works, but I can't declare it as Int then.
OK, thanks, lizmat. I'll stick to "my @foo" then. 11:58
12:02 reportable6 left, reportable6 joined 12:34 jjido left 12:59 mscha left 13:02 jjido joined 13:08 Zero_Dogg joined
Zero_Dogg Is there any quick way to get a filehandle for a Blob object? (usecase: have a Blob from LWP::Simple.get() that I need to pass to Compress::Zlib for decompression, Compress::Zlib throws `No such method 'eof' for invocant of type 'Buf'.`if I provide it with a Buf) 13:10
13:11 jjido left
lizmat hmm... doesn't LWP::Simple provide you with a method to get an IO::Handle compatible object ? 13:12
Zero_Dogg lizmat: not that I'm aware of (and not that I was able locate by skimming through the source) 13:18
lizmat I'm usually using Cro::HTTP::Client nowadys: cro.services/docs/reference/cro-http-client 13:21
I think that has support for decompression built in 13:22
Zero_Dogg Thanks, I'll give that a go. Has something changed with zef recently? It's failing to locate CBOR::Simple (which is an indirect dependency of Cro::HTTP::Client apparently) 13:28
lizmat japhb ^^ ??
Zero_Dogg: perhaps do a "zef upgrade zef", there's been a new release with a lot of fixes 13:29
Zero_Dogg Already have the latest 13:30
lizmat oki 13:31
I'd suggest first installing CBOR::Simple
Zero_Dogg (or so zef says, anyway)
lizmat $ zef --version
v0.13.4
is what I have
13:32 monkey_ joined
Zero_Dogg Okay so that's a lot newer than I have 13:32
13:40 Skarsnik joined
Zero_Dogg Outdated distro-provided zef (I thought I had it installed from rakudo-pkg). Replacing it with shiny new one did the trick. 13:43
13:51 aoeuidhtns joined
lizmat cool 13:52
Zero_Dogg Looks like it doesn't decompress though, and also returns a Blob for binary data. 13:56
Solved it with Libarchive::Filter :) 14:01
It accepts blobs 14:02
Skarsnik m: my Array of Int @foo; say @foo.WHAT 14:12
camelia (Array[Array[Int]])
14:15 aoeuidhtns left 14:38 jgaz joined 14:45 monkey_ left 14:59 monkey_ joined
timo m: my @foo is Array of Int; say @foo.WHAT 15:18
camelia (Array[Int])
15:18 monkey_ left
Skarsnik I wonder if there could be a nice way to tell the method FALLBACK to not be called when you misscall something in it (so it's not called again) 15:28
15:29 jgaz left 15:32 atroxaper joined
atroxaper lizmat: Hello. I've write the new blog. I'm thinking to proposal it to the advent. But, as you know, i'm not a native English. Could somebody to edit a google translate version and make the text be more Christmas? 15:33
corwin atroxaper: I bet there are folks here that could help with that! Post your translation here, and let's see! 15:34
atroxaper rakurs-atroxaper-net.translate.goo...x_tr_hl=ru 15:36
merryprog Ack. Russian to English google translate is /really/ bad. 15:37
atroxaper Not always, actually. 15:38
sienet_ja_LSD[m] have you tried this, www.deepl.com/translator
atroxaper Now. As I see, it a little bit better. Anyway, could somebody help me with it? I agree to gift the authorship and the idea of the post :) 15:42
15:45 vodkra left 15:52 vodkra joined 15:55 monkey_ joined
SmokeMachine Will it be called if you “disallow” it on signature? 16:01
m: class A { method FALLBACK(“test”) { say “fallback”; 42 }; A.test; A.something-else 16:03
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3allback”; 42 }; A.test; A.something-else7⏏5<EOL>
expecting any of:
statement end
statement modifier
statement modifier l…
SmokeMachine m: class A { method FALLBACK(“test”) { say “fallback”; 42 }}; A.test; A.something-else 16:04
camelia fallback
Constraint type check failed in binding to parameter '<anon>'; expected "test" but got "something-else"
in method FALLBACK at <tmp> line 1
in block <unit> at <tmp> line 1
tbrowder atroxaper: you could make a provisional entry in the Raku/advent title list for 2021 with a link to the article and need for help. 16:20
16:21 atroxaper left, atroxaper joined 16:23 mathias[m]12 joined
Skarsnik m: class A { method FALLBACK($name) { say $name; self.foo }; A.new.hello; 16:27
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3e) { say $name; self.foo }; A.new.hello;7⏏5<EOL>
Skarsnik m: class A { method FALLBACK($name) { say $name; self.foo }}; A.new.hello;
camelia (timeout)hello
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
16:28
Skarsnik m: class A { method FALLBACK($name) { say $name; self.foo(42, 11) }}; A.new.hello;
camelia hello
Too many positionals passed; expected 2 arguments but got 4
in method FALLBACK at <tmp> line 1
in method FALLBACK at <tmp> line 1
in block <unit> at <tmp> line 1
Skarsnik I am more talking about this, kinda confusing since the error point to FALLBACK again. x) 16:29
16:31 jgaz joined 16:39 monkey_ left 16:42 euandreh joined 16:48 monkey_ joined
Skarsnik I am more talking about this, kinda confusing since the error point to FALLBACK again. x) 16:58
oops x)
Is there a more clever way to get an enum value from a Str representing the key name than ASM65816::AddressingMode(ASM65816::AddressingMode.enums{$/[1]}[0]) ? 17:00
$/[1] contains the enum entry name
17:03 Woodi left
MasterDuke does ASM65816::AddressingMode("string") work? 17:10
17:11 djerius left
MasterDuke m: enum A <B C>; say A("B") # huh, i thought this worked 17:12
camelia No value 'B' found in enum A
in block <unit> at <tmp> line 1
Skarsnik A() expect the value, not the key x)
17:13 djerius joined
MasterDuke m: enum A <B C>; my $b = "B"; say A::<<$b>>.value 17:15
camelia 0
17:21 monkey_ left
Skarsnik Oh thanks :) 17:26
17:28 jgaz left 17:35 monkey_ joined 17:46 monkey_ left, jjido joined 17:55 squashable6 left 17:57 squashable6 joined 18:02 reportable6 left 18:05 reportable6 joined 18:08 Woodi joined 18:26 jjido left, jgaz joined 18:31 monkey_ joined 18:56 jgaz left 19:10 avar left, Skarsnik_ joined 19:12 TempIRCLogger left, jjido joined, Geth left 19:13 abraxxa-home left 19:14 Skarsnik left 19:15 abraxxa-home joined 19:16 avar joined 19:17 vasko left 19:20 monkey_ left 19:22 vasko joined 19:36 atroxaper left 19:53 ggoebel joined
ggoebel I must be missing something obvious, but I can't see it. Anyone willing to look at my nearly identical solutions to today's Advent Of Code puzzles in raku and perl and tell me why the raku one gives incorrect answers? 19:55
raku: gist.github.com/ggoebel/f06857bd3b...433f1e2c1f
evalable6 (exit code 1) Failed to open file /home/bisectable/git/whateverable/input: No such file or directory
in block <unit> at ./sandbox/05.raku line 3
ggoebel perl: gist.github.com/ggoebel/0dff89aa09...6a4a4110f3
vasko I'd look but I haven't done challenge 5 yet myself :P 19:57
[Coke] style note, you don't have to () the for or if params.
ggoebel coke: perl habits die hard :-) 19:58
gfldex style note, %grid{$x1}{$y} is equivalent to %grid{$x1;$y} 19:59
vasko gfldex Is the same true for arrays? 20:00
gfldex yes
ggoebel noted thx
vasko Cool, I only found out about multi-dim arrays yesterday and thought they were a different beast. 20:01
I'm eagerly anticipating the addition of ragged arrays and views.
gfldex A SemiList is a general concept in Raku.
m: @a = (1,2;3,4); dd @a; 20:02
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@a' is not declared
at <tmp>:1
------> 3<BOL>7⏏5@a = (1,2;3,4); dd @a;
[Coke] multi dim is different, yes
gfldex m: my @a = (1,2;3,4); dd @a;
camelia Array @a = [(1, 2), (3, 4)]
vasko Btw, I'm learning raku with AoC and am wondering how to make my $verbose arg from main global neatly. Anything better than `my $VERBOSE; sub MAIN(Bool :v(:$verbose)) { $VERBOSE = $verbose }`?
gfldex call it $*VERBOSE 20:03
ggoebel m: my @a = (1,2;3,4); @a[0;0]=5; .raku.say
camelia Cannot modify an immutable List ((1 2))
in block <unit> at <tmp> line 1
20:03 monkey_ joined
ggoebel so I guess I couldn't have used ++%grid{$x1;$y} 20:05
gfldex that works because $x1 and $y are containers.
ggoebel Cannot resolve caller prefix:<++>(List:D); the following candidates 20:07
match the type but require mutable arguments:
(Mu:D $a is rw)
gfldex vasko: if you want to go fancy on dynvars, this might help: gfldex.wordpress.com/2020/08/17/de...or-dynvar/
[Coke] so, the bug is in the second half (answers for part 1 are correct)
ggoebel I don't get the correct answer for part one when using my input... I do when using the example input 20:08
just a sec, I'll share my input
vasko gfldex: Thanks! I think `say $foo if $*verbose;` is quite neat. :) 20:09
ggoebel input: gist.github.com/ggoebel/d0417c4100...942c6547c5
[Coke] er, sorry. 20:10
gfldex vasko: I would stuff the check against $*verbos into a `sub debug(|c) { say(|c) if $*verbose }` .
[Coke] if you print out the "diag" coordinates it's looping over, they don't look right.
on the real input, first line, it swaps the coordinates, then is incrementing x by 10? 20:11
try making sure you're working with numbers and not strings, I think. 20:12
gfldex ggoebel: did you consider to have a type constraint in line 10? `my (Int:D $x1, Int:D $y1, Int:D $x2, Int:D $y2)` might catch mistakes.
[Coke] afk
20:13 Sgeo joined
vasko gfldex: What's the most idiomatic way to make it support calls as`debug 2, "Only print if -v 2 is set"`? 20:15
I can't find the docs for the `|c` annotation.
ggoebel I changed line 10 to: my ($x1, $y1, $x2, $y2) = .split(/\D+/, :skip-empty).map({+$_});
gfldex vasko: docs.raku.org/type/Signature#Capture_parameters
ggoebel and that fixed it...
thanks! 20:16
vasko Thanks, can I combine that with an optional `Int` infront of it?
I guess the multi signatures is what I want.
gfldex well, you have to do a sub signature then.
ggoebel Still a bit surprised $x1 .. $x2 was incrementing x by 10 20:17
hmm... $x1 .. $x2 -> $x was not incrementing x by 10. So I'm still not understanding how forcing numeric context fixed it. 20:20
gfldex vasko: gist.github.com/9c317047a1cabafcdc...98a76425e7 20:21
vasko: you just made me find an ENODOC :) 20:23
two ENODOCs acutally
well, I better check roast before I accuse to docs of incompleteness …
ggoebel what is perl automagically doing that I take for granted that raku is not? 20:28
vasko Thanks, I got that bit, but I want to have it take a level as well. 20:29
I guess I can just check `|c` is a Seq and then test if `|c[0]` is an Int, then `say(|c[1..]) if $*VERBOSE >= |c[0]`? 20:30
ggoebel vasko: not sure if this is what you're looking for... docs.raku.org/language/operators#prefix_| 20:32
vasko I think I'll settle for `sub verbose(:$n = 1, |c) { say(|c) if $*verbose >= $n }` so I can do `verbose :n(3), 'Only print this if the program is called with -v=3 or more'` 20:35
gfldex vasko: you can have a `sub MAIN(:v($*VERBOSE), :D(:debuglevel(*$DEBUG-LEVEL)) = 1) {}` 20:50
MasterDuke .tell atropaxer gist.github.com/MasterDuke17/b9ff1...a70ef2eca7 is a lightly edited version, it really didn't need a whole lot 20:52
tellable6 MasterDuke, I haven't seen atropaxer around, did you mean atroxaper?
MasterDuke .tell atroxaper gist.github.com/MasterDuke17/b9ff1...a70ef2eca7 is a lightly edited version, it really didn't need a whole lot
tellable6 MasterDuke, I'll pass your message to atroxaper
20:59 discord-raku-bot left 21:00 discord-raku-bot joined 21:06 jjido left 21:14 nebuchadnezzar left 21:26 jjido joined
vasko ggoebel I just ran into the same problem :D 21:29
> ("123".."234").map: *.say
123
124
133
134
223
224
233
234
Is why it was failing. I personally went for `.map: *.Int` I feel your way is to perly :P 21:30
21:44 jjido left
ggoebel vasko: thanks! So raku supports str ranges. Though I have to say, I don't understand how they work. 21:52
m: ("12".."21").flat.say
camelia (12 11 22 21)
ggoebel m: ("12".."19").flat.say
camelia (12 13 14 15 16 17 18 19)
MasterDuke ranges operated by calling .succ docs.raku.org/routine/succ#(Str)_method_succ 21:54
gfldex vasko: Why so verbose? `».Int` will cut it! :-> 21:55
vasko gfldex I'm still learning. Cool, any time I would want to use `.map` over `»`? 22:01
gfldex It's a hyper ans as such a candiate for auto-threading. Beside that, it's just shorter for simple cases. 22:02
ggoebel MasterDuke: thanks for the link to the relevant docs. Maybe I'm being dim, but I still don't understand how "12".."21" increment steps result in (12 11 22 21)
"Ranges always go from small to larger elements; if the start point is bigger than the end point, the range is considered empty." 22:03
gfldex m: say ('filename-aaa.txt' .. 'filename-zzz.txt')[1..10, 900..910];
camelia ((filename-aab.txt filename-aac.txt filename-aad.txt filename-aae.txt filename-aaf.txt filename-aag.txt filename-aah.txt filename-aai.txt filename-aaj.txt filename-aak.txt) (filename-biq.txt filename-bir.txt filename-bis.txt filename-bit.txt filename-…
ggoebel how is "11" a larger element than "12"
gfldex that's what it's meant to be used for
MasterDuke m: say "12".succ 22:04
camelia 13
MasterDuke m: .say for "12".."21"
camelia 12
11
22
21
22:04 jjido joined
MasterDuke that's...interesting 22:04
gfldex You are iteration over a subset of ASCII, so to speak.
MasterDuke well, it's been that was since the initial christmas release. raku does str incrementing/ranges differently than perl, but i can't quite explain that result right now 22:06
22:08 RakuIRCLogger left, Geth joined, RakuIRCLogger joined 22:10 TempIRCLogger joined
ggoebel per Coke and gfldex's suggestions, I'll just have to remember coerce things into Ints to avoid character ranges. 22:12
I think I prefer changing line 10 to: my (Int(Str) $x1, Int(Str) $y1, Int(Str) $x2, Int(Str) $y2) = .split(/\D+/, :skip-empty); 22:14
more verbose, but hard to get confused about what's going on 22:15
thanks for all the help
22:25 jjido left 22:34 MoC left
tbrowder why not use 12..21 if that’s what you intend? 22:36
gfldex He does now. That's where the bug was. 22:37
22:58 monkey_ left 23:19 ggoebel left 23:35 ggoebel joined 23:40 Skarsnik_ left