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 VAA28846; Wed, 14 Apr 2004 21:21:30 +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 VAA29597 for ; Wed, 14 Apr 2004 21:21:29 +0200 (MET DST) Received: from mail4.bluewin.ch (mail4.bluewin.ch [195.186.4.74]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3EJLTYM014697 for ; Wed, 14 Apr 2004 21:21:29 +0200 Received: from [10.0.1.2] (81.62.142.191) by mail4.bluewin.ch (Bluewin AG 7.0.027) id 4055A0EF004C89AE; Wed, 14 Apr 2004 19:21:28 +0000 In-Reply-To: <20040414190532.GQ10439@students.uiuc.edu> References: <20040414190532.GQ10439@students.uiuc.edu> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <131E0249-8E49-11D8-A972-000393DBC266@epfl.ch> Content-Transfer-Encoding: 7bit Cc: caml-list@inria.fr From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Subject: Re: [Caml-list] '_a out of nowhere? (list.reverse) Date: Wed, 14 Apr 2004 21:22:31 +0200 To: "Seth J. Fogarty" X-Mailer: Apple Mail (2.613) X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 3.07:01 val:01 val:01 char:01 faq:01 faq:01 faibles:01 caml:01 caml:01 int:01 unbound:02 types:03 cons:03 cons:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 350 Objective Caml version 3.07+2 # let cons x y = x::y and flip f x = f y x;; Unbound value y # let cons x y = x::y and flip f x y = f y x;; val cons : 'a -> 'a list -> 'a list = val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c = # let reverse = fun l -> List.fold_left (flip cons) [] l;; val reverse : 'a list -> 'a list = # reverse [1;2;3];; - : int list = [3; 2; 1] # reverse ['a';'b';'c'];; - : char list = ['c'; 'b'; 'a'] It's a faq, Daniel ------------------- 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