Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Pattern-matching destructors ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jeff Shaw <shawjef3@m...>
Subject: Re: Pattern-matching destructors ?
If you're matching against a record, you can omit the values you don't 
care about. For instance:

type test = {a : int; b : int}

let testfun = function {a=x; b= y} when x=y -> "same" | {a=x} -> ("a is 
" ^ string_of_int x);;

I'm not sure if this helps you but it's the first thing I thought off.