Version française
Home     About     Download     Resources     Contact us    
Browse thread
from if...else to pattern matching
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: ben kuin <benkuin@g...>
Subject: Re: [Caml-list] from if...else to pattern matching
>
> # let t x = match x with
>  a when x<=4 -> true
>  | _ -> false;;
>

ok, I had a similar attempt with

    let tt x = function
    a when x<=4 -> true
    | _ -> false;;

but that gave me the following (scary  -> 'a -> ) signature

     val tt : int -> 'a -> bool = <fun>

so I stopped

thanks anyway