You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've seen it several times on #perl6 when people tried to do this when they first learned aout »:
<a b c d>».say# Oops!
Well, okay, it works today, but the idea is that the execution order is not defined, so doing ».say is probably not the best idea.
OK, I get it. But still, if I don't care about the execution order, I can use » anywhere I use .map, right?
Oops.
See this:
say (<a b c d>, <x y z>).map: *.elems # (4 3) ← OK, that's what we want
say (<a b c d>, <x y z>)».elems # (4 3) YEAH, it works, great!
# but we may want to use something more
# complex than just a method call. For example this:
say (<a b c d>, <x y z>).map: *.elems × -1 # (-4 -3)
say (<a b c d>, <x y z>)».&(*.elems × -1) # ((-1 -1 -1 -1) (-1 -1 -1)) – ??? Why?
say (<a b c d>, <x y z>).deepmap: *.elems × -1 # ((-1 -1 -1 -1) (-1 -1 -1)) – OK, so it's like deepmap in this case…
There are actually two cases to cover.
I've seen it several times on
#perl6when people tried to do this when they first learned aout»:Well, okay, it works today, but the idea is that the execution order is not defined, so doing
».sayis probably not the best idea.OK, I get it. But still, if I don't care about the execution order, I can use
»anywhere I use.map, right?Oops.
See this:
Perhaps see these conversations:
The text was updated successfully, but these errors were encountered: