Browse thread
[Caml-list] List.sort
-
Johann Spies
- Stefano Zacchiroli
- Henri Dubois-Ferriere
- Remi VANICAT
- Alessandro Baretta
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2002-06-19 (15:15) |
From: | Stefano Zacchiroli <zack@c...> |
Subject: | Re: [Caml-list] List.sort |
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