Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Function definition with multiple patterns in multiple equations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Francois Thomasset <francois.thomasset@i...>
Subject: Re: [Caml-list] Function definition with multiple patterns in multiple equations
> I am trying to define a function in OCaml with multiple equations (rules)
> and multiple patterns in each equation.
It looks like this is what you want:
let f x = function
  0 when x = 0 -> 1
  | _ -> 0;;

-- 
					François Thomasset.
					INRIA (A3)

Tel: +33 (1) 39-63-54-75
Fax: +33 (1) 39-63-53-30 ou +33 (1) 39-63-59-95
Email: Francois.Thomasset@inria.fr
Smail: INRIA, Rocquencourt, BP 105, 78153 Le Chesnay Cedex, France


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr