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 QAA29920; Fri, 29 Nov 2002 16:29:59 +0100 (MET) 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 QAA29876 for ; Fri, 29 Nov 2002 16:29:58 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gATFTvX01173; Fri, 29 Nov 2002 16:29:57 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA29964; Fri, 29 Nov 2002 16:29:57 +0100 (MET) Date: Fri, 29 Nov 2002 16:29:57 +0100 From: Xavier Leroy To: "altavillasalvatore@libero.it" Cc: caml-list Subject: Re: [Caml-list] small exercise Message-ID: <20021129162957.C27468@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from altavillasalvatore@libero.it on Fri, Nov 29, 2002 at 04:19:50PM +0100 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > input: string "1.15.120.13.43.35.340.190.0" > output: int array= [| 1; 15; 120; 13; 43; 35; 340; 190; 0; |] That's easy: let answer_to_the_exercise = function "1.15.120.13.43.35.340.190.0" -> [| 1; 15; 120; 13; 43; 35; 340; 190; 0; |] I'm sure your professor will love this solution, as it is not only correct w.r.t. the specification, but also quite concise. - Xavier Leroy P.S.1: this list isn't for doing student's homework. P.S.2: the beginner's list http://groups.yahoo.com/group/ocaml_beginners isn't either, but you might find more sympathy there. ------------------- 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