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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@m...>
Subject: Re: [Caml-list] Complex numbers in ocaml
"Post Office!~/sentmail" wrote:
> 
> I'm trying to write a system for complex numbers in ocaml for some
> numerical work I'm doing, and I thought I'd ask if anyone else has such
> code already existant.
> 
> Otherwise, given an abstract for numbers
>         type number = Int of int | Float of float | Complex of float *
> float | Error;;
> 
> is there an easy way to coerce numbers back out of type number in order to
> operate on them?

	match n with 
	| Int i -> ..
	| Float x -> ...
	| Complex (x,y) -> ...
	| Error -> ...

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au 
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
New generation programming language Felix  http://felix.sourceforge.net
Literate Programming tool Interscript     
http://Interscript.sourceforge.net
-------------------
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