From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA24596; Fri, 11 Jun 2004 21:38:22 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA24669 for ; Fri, 11 Jun 2004 21:38:21 +0200 (MET DST) Received: from salt.cs.brown.edu (salt-dmz.cs.brown.edu [128.148.32.122]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i5BJcJSH013771 for ; Fri, 11 Jun 2004 21:38:20 +0200 Received: from localhost (localhost [127.0.0.1]) by salt.cs.brown.edu (Postfix) with ESMTP id 5ECD8D86F2 for ; Fri, 11 Jun 2004 15:38:19 -0400 (EDT) Received: from salt.cs.brown.edu ([127.0.0.1]) by localhost (salt [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08175-01 for ; Fri, 11 Jun 2004 15:38:19 -0400 (EDT) Received: from null.cs.brown.edu (null.cs.brown.edu [128.148.38.190]) by salt.cs.brown.edu (Postfix) with ESMTP id 3634ED86D4 for ; Fri, 11 Jun 2004 15:38:19 -0400 (EDT) Received: from twix.cs.brown.edu (twix [128.148.31.40]) by null.cs.brown.edu (Postfix) with ESMTP id 1941C3CAF for ; Fri, 11 Jun 2004 15:38:19 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by twix.cs.brown.edu (Postfix) with ESMTP id E1CAD57264 for ; Fri, 11 Jun 2004 15:38:18 -0400 (EDT) Received: from twix.cs.brown.edu ([127.0.0.1]) by localhost (twix [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31749-01 for ; Fri, 11 Jun 2004 15:38:18 -0400 (EDT) Received: from spikeshomepc (meylan-1-82-225-49-106.fbx.proxad.net [82.225.49.106]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by twix.cs.brown.edu (Postfix) with ESMTP id 0A43457251 for ; Fri, 11 Jun 2004 15:38:17 -0400 (EDT) Reply-To: From: "John Hughes" To: Subject: [Caml-list] More or bignums/ints Date: Fri, 11 Jun 2004 21:38:29 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 thread-index: AcRP66vXWE3Sdf+hSImbnP3oclCSmA== Message-Id: <20040611193818.0A43457251@twix.cs.brown.edu> X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at cs.brown.edu X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at cs.brown.edu X-Miltered: at concorde with ID 40CA0A2B.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; bignums:01 bignums:01 debugger:01 bignum:01 -like:01 debugger:01 dialect:01 ints:01 ints:01 ocaml:01 ocaml:01 int:01 arithmetic:01 sml:01 sml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I've read the May interchange in CWN that started with the question > I have made a web search to understand which kind of support for > bignums is available for OCaml... and found it interesting. I'll be teaching a few weeks of ML as part of a first-year course at Brown University, and we've used SML in previous years. SML/NJ works OK, but we'd like a debugger, so I've looked at OCaml as a possible alternative. I was a little depressed to find (by trial and error) that "int" doesn't mean "integer" but rather "element of Z/nZ for some very large n, represented with integer notation, including negative signs." I think I can live with this if only there's some way to write something like this (pseudo-ML/Java): fun fact(0) = 1 | fact(n) = try { n * fact(n-1) } catch (IntegerOverflow e) ... What I don't think I can bear is to use the sorts of "bignum"-like libraries that make me write things like y = x bigadd big-unit to mean y = x + 1 because our students will actually be writing some code that has a good deal of arithmetic in it. --- So the questions are 1. Is there a way to catch overflow exceptions within an entire computation? 2. Is there a way to tell OCaml that ints really are either (a) bignums or (b) overflow-protected ints (as in SML/NJ, for instance) Perhaps the implicit third question is 3. Is there a reasonable debugger for some dialect of ML that has what I might call "protected integers"? Thanks very much in advance. -John Hughes ------------------- 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