This looks very interesting! I sometimes wish Haskell had more powerful binding facilities, so that things like this don't need to be extensions to the language. (But I'm not sure exactly what I'm wishing for...)
On Sat, May 15, 2004 at 12:08:53PM +0000, Niklas Broberg wrote: > Introducing regular expressions into the pattern matching facility gives > some extra nice features. One is that the regular patterns are "type safe", > i.e. they are not encoded in strings. Another is that identifiers can be > named and bound inside regular patterns, examples: > foo [/ _* a /] = ... => a is bound to the last element of the list > foo [/ a@(/ _ _ /) _* /] = ... => a is bound to the list containing the > first two elements > foo [/ (/ a _ /)* /] = ... => a is bound to the list of the first, third, > fifth etc elements of a list of even length What about foo [/ (/ 2 (/ a _ /)* 3 /)* /] = a ? What is the type of a here? I think it should be [[Int]]. And then which special syntax for implicit binding am I supposed to use? Is it foo [/ (/ 2 (/ a@:(/_ _/) _ /)* 3 /)* /] = a or maybe foo [/ (/ 2 (/ a@::(/_ _/) _ /)* 3 /)* /] = a ? And what's the type? [[[Int]]]? Peace, Dylan
signature.asc
Description: Digital signature
_______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell