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 AAA15907; Wed, 4 Dec 2002 00:21:13 +0100 (MET) 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 AAA16503 for ; Wed, 4 Dec 2002 00:21:12 +0100 (MET) Received: from pop9.ucdavis.edu (pop9.ucdavis.edu [169.237.105.19]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gB3NLA109193 for ; Wed, 4 Dec 2002 00:21:10 +0100 (MET) Received: from beech ([128.120.141.217]) by pop9.ucdavis.edu (8.11.6/8.11.0/IT4.6.2) with ESMTP id gB3NL8r19295 for ; Tue, 3 Dec 2002 15:21:08 -0800 (PST) Received: from ijtrotts by beech with local (Exim 3.36 #1 (Debian)) id 18JMMl-0005td-00 for ; Tue, 03 Dec 2002 15:22:11 -0800 Date: Tue, 3 Dec 2002 15:22:11 -0800 To: OCaml Mailing List Subject: Re: [Caml-list] function Message-ID: <20021203232211.GC22545@beech> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i From: Issac Trotts Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, Dec 02, 2002 at 04:55:06PM +0100, altavillasalvatore@libero.it wrote: > Hi all, > I would want to know if a function exists that allows me to make this: > > ["123";"45";"678"] -> [1;2;3;4;5;6;7;8;]. let f l = let ret = ref [] in String.iter (fun c -> ret := ((int_of_char c) - (int_of_char '0')) :: !ret) (List.fold_left (^) "" l); List.rev !ret;; f ["123";"45";"678"];; Cheers, Issac Trotts ------------------- 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