The BQN list operator ‿
can readily transfer into Raku. It's basically the same as Raku's list operator: ,
.
There is a small devil in the detail and that can be illustrated in the following example:
multi sub infix:<‿> ($a, $b) {
infix:<,>($a, $b)
}
say 1‿2‿3; # ((1 2) 3)
An easy thought as to a solution would be to flatten the result of the infix operation, but that would be incorrect. The trick is to flatten only when the LHS is a List. So a better version of the above operation is as follows:
# Can't use SmartMatch because Array ~~ List is True!
multi sub infix:<‿> ($a, $b) {
infix:<,>($a.WHAT === List ?? |$a !! $a, $b)
}
say 1‿2‿3 # (1 2 3)
say [1‿2]‿3 # ([1 2] 3)
Would be interested in hearing from some of the BQN coders out there if this works for them.