Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] variant type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alex Romadinoff <alexeyr@N...>
Subject: RE: [Caml-list] variant type
Hi

Just think what is the type of your function?
shape -> int or shape -> float ????

Regards,
Alex

-----Original Message-----
From: owner-caml-list@pauillac.inria.fr
[mailto:owner-caml-list@pauillac.inria.fr] On Behalf Of Ye Wu
Sent: Tuesday, June 17, 2003 10:04 PM
To: caml-list@inria.fr
Subject: [Caml-list] variant type

Could you please tell me why the following doesn't work?

type shape = Square of int * int * int
        |Circle of float * float * float;;
let area s =
  match s with
    Square (_, _, d) -> d * d
   |Circle (_, _, r) -> 3.14 *. r *. r;;

Regards,
Ye


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives:
http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ:
http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners