Op 27-06-2022 om 11:14 schreef Paul "LeoNerd" Evans: > On Mon, 27 Jun 2022 02:11:08 -0700 > Darren Duncan <darren@darrenduncan.net> wrote: > >> This should be generic and configurable in the same way map/grep/sort >> etc are. > I'm not sure I follow this bit. How are those configurable now? > > Can you suggest some examples? > Map/grep/sort can take a sub which does the comparison/filter. Darren makes a good observation that that is actually quite similar to your proposed match/case, where you give the operator. I think what Darren means is that it may make sense to think about both extending your proposal to sort and friends and apply a more generic approach to match/case: @x = sort : <=> @x; # we need a better syntax than this and a generic comperator to match/case: match ($n : sub($a, $b) { $a==$b }) case(1) { say "It's one" } case(2) { say "It's two" } ... or maybe match (sub($a) { $a==$n }) case(1) { say "It's one" } case(2) { say "It's two" } ... However, apart from sort using the spaceship operator -- which would admitedly be very cool and rather useful, I myself do not see enough value in both operators. So while it would be more generic, I doubt it's actually useful enough. There may be value with oveloading and custom infix operators though. HTH, M4 HTH, M4Thread Previous | Thread Next