Version française
Home     About     Download     Resources     Contact us    
Browse thread
ANN: pattern guards
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <bhurt@j...>
Subject: Re: [Caml-list] ANN: pattern guards
Jeremy Yallop wrote:

>
> Unless I'm mistaken you can write this as
>
>     match x with
>     | Y (y as z)
>     | X (y,z)    -> f y z
>
> Is there some more general case for which this won't work out?
>

I often times want to be able to write code like:
    match foo with
    | Y (y) with x = 3
    | X(x, y) ->
       f x y

Brian