🦋 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.
patrickb [Coke]: I believe I have fixed your module installation issue on Windows you recently sent a Gist about. It should go into the 2025.10 release. 09:56
lizmat 01 I presume ?
patrickb :-P
Yes
librasteve I am a bit surprised by this ... 17:05
m: my %i = :one[1], :two[2]; class A { has $.one; has $.two }; A.new(|%i).raku.say; 17:06
evalable6 A.new(one => $[1], two => $[2])
Raku eval A.new(one => $[1], two => $[2])
librasteve vs this...
m: my %i = :one[1], :two[2]; class B { has @.one; has @.two }; B.new(|%i).raku.say;
Raku eval B.new(one => [[1],], two => [[2],])
evalable6 B.new(one => [[1],], two => [[2],])
librasteve seems that if I put an Array as a Pair value, then I have to flatten somewhere to stick it into an Array attr ... I guess this is what is intended, but it seems kinda odd to have to remember to do that 17:08
timo m: my %i = :one(1,), :two(2,); class B { has @.one; has @.two }; B.new(|%i).raku.say; 17:10
camelia B.new(one => [(1,),], two => [(2,),])
timo m: my %i = :one(1,), :two(2,); %i.raku.say 17:11
camelia {:one($(1,)), :two($(2,))}
timo m: my %i; %i<one> := [1]; %i<two> := [2]; %i.raku.say
camelia {:one([1]), :two([2])}
timo m: my %i; %i<one> := [1]; %i<two> := [2]; %i.raku.say; class B { has @.one; has @.two }; B.new(|%i).raku.say;
camelia {:one([1]), :two([2])}
B.new(one => [1], two => [2])
timo m: my %i is Map = :one[1], :two[2]; %i.raku.say 17:12
camelia Map.new((:one([1]),:two([2])))
timo m: my %i is Map = :one[1], :two[2]; %i.raku.say; class B { has @.one; has @.two }; B.new(|%i).raku.say; 17:13
camelia Map.new((:one([1]),:two([2])))
B.new(one => [1], two => [2])
timo you need something that doesn't put scalar containers in the values of %i if you want them to be assigned the way you wanted it to
librasteve timo: yeah, I see --- most of the time I am impressed that the @ and % classes and literals dwim --- so I usually recommend that beginners go with @ and % sigils to start with before having to juggle containers ... I guess example lies beyond the sugar and you just have to know the underlying features 17:31
[Coke] no fix going into the .01 release at this point. 18:19
Let's get it in a branch and CI tested, though
SmokeMachine I think I understand why it isn’t… but should something like this be possible? glot.io/snippets/h40cui46g4 19:02
I mean, should FALLBACK validate the signature for the caller? I mean, should it also be called if the only method found expects the caller to be defined, the FALLBACK expects undefined and the caller is undefined? (Maybe too specific…) 19:08
xinming Is there a better way to detect list contains certian element except using .first? 20:18
[Coke] That's probably the best unless you can be working with another data structure like a Set 20:19
wambash m: say so 9 == (1,2,3,4).any ** 2 20:27
Raku eval True
evalable6 True
xinming Got it, thanks 20:30
ugexe grep 21:15
ugexe m: say so grep { 9 == $_ }, 1..Inf 21:17
camelia True
ugexe it is slightly better than first in that its return value in boolean context is explicitly if the element was there 21:19
first returns the first element found, which you already know anyway
timo when the first element found by .first happens to falsish or undefined, it's not trivial to figure out if it was there or not, so you would most probably want `.first` with `:k` and `with` or `so ... .defined` 21:34
[Coke] O_o; that seems counterintuitive to me. 21:39
Xliff .release 22:03
jdv .what 22:04
[Coke] I'm working on it 22:09
Xliff Working on what? 22:11
I was just wondering if 2025.01 was going to be cut this weekend.
[Coke] ... the release. 22:12
Xliff Oh, cool! [Coke]++
[Coke] I got about 90% of the way through and then realized I can't do it on a mac, so am switching to a linux box now.
nahita3882 $val ∈ @list is also an option 22:24
timo right! as well as nelem) if you prefer words 22:36