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 SAA29345; Fri, 22 Oct 2004 18:57:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA29104 for ; Fri, 22 Oct 2004 18:57:46 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i9MGvfKd004836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 22 Oct 2004 18:57:44 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.13.1/8.12.11) with ESMTP id i9MGvE7L012722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 22 Oct 2004 11:57:16 -0500 (CDT) Date: Fri, 22 Oct 2004 12:06:16 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: skaller cc: "Robert M. Solovay" , David Brown , Jon Harrop , caml-list Subject: Re: [Caml-list] Polymorphism and the "for" loop In-Reply-To: <1098425963.7584.9.camel@pelican.wigram> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 41793C05.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 bug:01 ocaml's:01 ocaml:01 ocaml:01 int:01 unit:03 unit:03 string:03 wrote:03 wrote:03 oct:03 redirect:95 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 22 Oct 2004, skaller wrote: > On Fri, 2004-10-22 at 12:22, Robert M. Solovay wrote: > > How does one define a function f of type int -> void? I looked in the > > OCaml manual and couldn't find any reference to "void". {It is, of course, > > a familiar concept in C.} > > That's right. Ocaml has no void type. I consider that a bug. unit is Ocaml's void. There are some subtle differences, but generally anything you use void for in C, you use unit for in Ocaml. As a side note, the correct return type for functions that don't return is 'a. This allows code like: let do_something = function | h :: _ -> h | [] -> invalid_arg "do_something failed!" ;; Note that the invalid_arg function has a type string -> 'a. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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