🦋 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.
[Coke] m: my Int \z = 42; z :=100; 04:43
camelia ===SORRY!=== Error while compiling <tmp>
Cannot bind to 'z' because it is a term and terms cannot be rebound
at <tmp>:1
------> my Int \z = 42; z :=100⏏;
[Coke] m: my Int \z = 42; z := 'x'
camelia ===SORRY!=== Error while compiling <tmp>
Cannot bind to 'z' because it is a term and terms cannot be rebound
at <tmp>:1
------> my Int \z = 42; z := 'x'⏏<EOL>
[Coke] bisectable6: m: my Int \z = 42; z :=100;
bisectable6 [Coke], Will bisect the whole range automagically because no endpoints were provided, hang tight
[Coke], Output on all releases: gist.github.com/9e5f2e2e374e302da6...eb92ed5af9 04:44
[Coke], Bisecting by exit code (old=2021.10 new=2021.12). Old exit code: 0
[Coke], bisect log: gist.github.com/2fb27de4ecf106e956...b914c00cbe
[Coke], (2021-11-07) github.com/rakudo/rakudo/commit/90...6f5f6711d1
[Coke], ⚠ New output detected, please review the results manually
[Coke], Output on all releases and bisected commits: gist.github.com/6f770a2858b5477de4...81e4e067e6
Geth ¦ doc: coke assigned to JJ Issue doc/Type/Signature.pod6 fails make xtest github.com/Raku/doc/issues/4012 04:51
tbrowder howdy, question for experts: given an object '$s', is it possible to create Raku methods to return a single value using these two syntaxes: '$s<a>' and '$s[1;2]'? 12:43
to be clear, each method should return one value 12:45
the object is an array 12:46
rather the object has an array as one attribute 12:47
i'm thinking that if i define an operator like <> or [] inside the class it might work somehow magically if done properly...or with a role... 13:03
tbrowder hm, '$s.<>' or '$s.[]'... 13:09
or '$s.cell<>' or '$s.cell[]' 13:10
El_Che tbrowder: you're a busy bee :) 13:12
Voldenet I'm not an expert, but 13:17
m: sub postcircumfix:<{ }>(@container, **@key) { 42 }; my $s = []; $s<a>.say
camelia 42
Voldenet it ruins the operator in the process though 13:19
m: augment class Array { multi method AT-KEY(Array:D: $key) is raw { 42 } }; my $s = []; $s<a>.say; 13:30
camelia ===SORRY!=== Error while compiling <tmp>
augment not allowed without 'use MONKEY-TYPING'
at <tmp>:1
------> augment class Array⏏ { multi method AT-KEY(Array:D: $key) is
expecting any of:
generic role
Voldenet m: use MONKEY-TYPING; augment class Array { multi method AT-KEY(Array:D: $key) is raw { 42 } }; my $s = []; $s<a>.say;
camelia 42
Voldenet m: role Nice { multi method AT-KEY(Array:D: $key) is raw { 42; } }; my $s = [] but Nice; $s<a>.say 13:36
camelia 42
lizmat tbrowder: is the object of a class of your own making?
Voldenet Nice.
lizmat tbrowder ^^
[Coke] m: .say for $*ARGFILES.lines; 14:44
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Am Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
[Coke] m: use v6.d; .say for $*ARGFILES.lines; 14:45
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Am Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
[Coke] m: use v6.d; sub MAIN() {.say for $*ARGFILES.lines;}
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Am Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
[Coke] ... why is this not working locally? Weird.
*FACEPALM*. because I already have a script with this handy short name earlier in my PATH. You would think I had learned this lesson by now. 14:46
Guest40 Hi 14:56
lizmat Guest40 o/
guifa Voldenet: just make it a multi; multi sub postcircumfix:<{ }>(@, **@) { … } 15:04
tonyo you don't really need the `but` in there, this'll work fine too 17:02
m: role X { multi method AT-KEY($k) { $k }; }; my $l = X.new; say $l<a>; say $l<b>;
camelia a
b
tonyo the [X;Y] syntax would require some grammar 17:13
tbrowder .tell lizmat yes, my class 17:40
tellable6 tbrowder, I'll pass your message to lizmat
lizmat tbrowder: then add an AT-KEY method to it 17:41
lizmat m: class A { method AT-KEY($key) { say "fetching $key" } }; my $a = A.new; $a<foo>' 17:42
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> tching $key" } }; my $a = A.new; $a<foo>⏏'
expecting any of:
infix
infix stopper
statement end
statement …
lizmat m: class A { method AT-KEY($key) { say "fetching $key" } }; my $a = A.new; $a<foo>
camelia fetching foo
tbrowder ok, thnx, enough to experiment with. thnx Voldenet 17:43
tonyo AT-POS can be done in a similar way but requires a little more fanagling 18:11
tbrowder and lizmat 18:32
and tonyo
tonyo m: role X { multi method AT-KEY($k) { $k }; multi method AT-POS(X: Int:D \p) { "{p + 1}"; }; }; my $l = X.new; say $l<a>; say $l<b>; say $l[1, 2]; 18:35
camelia a
b
(2 3)
tonyo AT-POS is called twice in that pattern ^
Geth examples: sdondley++ created pull request #93:
solution for prob17
18:54
Geth examples: sdondley++ created pull request #94:
solution for problem #6
23:15