Re: Pattern matching on arrays and for loops

2006-01-14 Thread Brad Bowman
On 14/01/06 00:59, Larry Wall wrote: That doesn't seem sufficiently general. I'd rather see some context that can apply a signature to the head of a list and treat the unslurped part as unmatched. Maybe a for loop could be taught to supply such a context, or a when. Or maybe it's just the

Re: Pattern matching on arrays and for loops

2006-01-13 Thread Luke Palmer
On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote: I'm trying to work out if there's a clever perl6 way to write this using pattern matching: for @*ARGV - -f, $filename { $filename .= absolute_filename; } There is, but it's a different kind of pattern matching: if @*ARGV ~~ / ,

Re: Pattern matching on arrays and for loops

2006-01-13 Thread Dave Whipp
Luke Palmer wrote: On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote: Would this actually work, or would it stop at the first elem that doesn't match (-f, ::Item)? If by stop you mean die, yes it would stop. not what I wanted :-( Is there some way to associate alternate codeblocks for

Re: Pattern matching on arrays and for loops

2006-01-13 Thread Luke Palmer
On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote: What happens if I simply abandon the attempt at anonymous MMD and use a named multi-sub, instead: { my multi sub process_arg(-f, Str $f is rw) { $f .= absolute_filename } my multi sub process_arg(--quux, Str arg1, Str arg2) {

Re: Pattern matching on arrays and for loops

2006-01-13 Thread Larry Wall
On Fri, Jan 13, 2006 at 11:42:13PM +, Luke Palmer wrote: : On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote: : What happens if I simply abandon the attempt at anonymous MMD and use a : named multi-sub, instead: : : { : my multi sub process_arg(-f, Str $f is rw) { :$f .=