Michael Lazzaro wrote:
(@foo,@bar,@zap) := classify { /foo/ ;; /bar/ ;; /zap/ } @source;
A shorthand ... that "classifies" (or "parts") @source according to
> the results of a series of tests, not just one.
You mean, like: (@foo,@bar,@zap) := part { when /foo/ {0}; when /bar/ {1}; when /zap/ {2} } @source; ??? And there's always: push (/foo/ && @foo || /bar/ && @bar || /zap/ && @zap), $_ for @source; But perhaps there would also be a hashed form, in which each key is a test (i.e. a rule or closure) and each value an index: (@foo,@bar,@zap) := part { /foo/ => 0, /bar/ => 1, /zap/ => 2 }, @source; or even a arrayed form, when the corresponding index was implicit: (@foo,@bar,@zap) := part [/foo/, /bar/, /zap/], @source; Damian