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 RAA26968; Wed, 19 Jun 2002 17:15:48 +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 RAA19427 for ; Wed, 19 Jun 2002 17:15:47 +0200 (MET DST) Received: from cantina.students.cs.unibo.it (cantina.students.cs.unibo.it [130.136.3.110]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g5JFFlj26760 for ; Wed, 19 Jun 2002 17:15:47 +0200 (MET DST) Received: from lordsoth.takhisis.org ([130.136.33.14]) (authenticated (0 bits)) by cantina.students.cs.unibo.it (8.12.0.Beta19/8.12.0.Beta19/Debian 8.12.0.Beta19) with ESMTP id g5JFFBIk004671 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=192 verify=FAIL) for ; Wed, 19 Jun 2002 17:15:41 +0200 Received: from lordsoth.takhisis.org (lordsoth.takhisis.org [127.0.0.1]) by lordsoth.takhisis.org (8.12.4/8.12.4/Debian-2) with ESMTP id g5JFEh9p031830 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 19 Jun 2002 17:14:43 +0200 Received: (from zack@localhost) by lordsoth.takhisis.org (8.12.4/8.12.4/Debian-2) id g5JFEhWY031828 for caml-list@inria.fr; Wed, 19 Jun 2002 17:14:43 +0200 Date: Wed, 19 Jun 2002 17:14:43 +0200 From: Stefano Zacchiroli To: caml-list@inria.fr Subject: Re: [Caml-list] List.sort Message-ID: <20020619151443.GA31721@cs.unibo.it> Mail-Followup-To: caml-list@inria.fr References: <20020619085454.GA5244@adept.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020619085454.GA5244@adept.co.za> User-Agent: Mutt/1.4i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Jun 19, 2002 at 10:54:54AM +0200, Johann Spies wrote: > I am trying to figure out how to use List.sort. Look at the List.sort type: ('a -> 'a -> int) -> 'a list -> 'a list the first "argument" required by List.sort have type "function that takes two arguments of the same type and return an int". The type of compare is: 'a -> 'a -> int you then have to pass the function compare itself without applying it (as I saw in one of your example). This is a sample usage: List.sort compare [3;2;1] Indeed "List.sort compare" have type 'a list -> 'a list Cheers. -- Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro "I know you believe you understood what you think I said, but I am not sure you realize that what you heard is not what I meant!" -- G.Romney ------------------- 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