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 UAA03245; Mon, 25 Jun 2001 20:40:16 +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 UAA03408 for ; Mon, 25 Jun 2001 20:40:16 +0200 (MET DST) Received: from mailrelay3.inwind.it ([212.141.54.103]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f5PIeFL04494 for ; Mon, 25 Jun 2001 20:40:15 +0200 (MET DST) Received: from dalamar.krynn.it (62.98.124.67) by mailrelay3.inwind.it (5.5.029) id 3B30CCFA00157AEA for caml-list@inria.fr; Mon, 25 Jun 2001 20:40:13 +0200 Received: from kitiara.krynn.it (kitiara.krynn.it [192.168.1.116]) by dalamar.krynn.it (8.12.0.Beta7/8.12.0.Beta7/Debian 8.12.0-1) with ESMTP id f5PIeB8n000608 for ; Mon, 25 Jun 2001 20:40:11 +0200 Received: from kitiara.krynn.it (localhost [127.0.0.1]) by localhost (8.12.0.Beta10/8.12.0.Beta10/Debian 8.12.0.Beta10) with ESMTP id f5PIeBVK007137 for ; Mon, 25 Jun 2001 20:40:11 +0200 Received: (from zack@localhost) by kitiara.krynn.it (8.12.0.Beta10/8.12.0.Beta10/Debian 8.12.0.Beta10) id f5PIeBZW007135 for caml-list@inria.fr; Mon, 25 Jun 2001 20:40:11 +0200 Date: Mon, 25 Jun 2001 20:40:07 +0200 From: Stefano Zacchiroli To: caml-list@inria.fr Subject: Re: [Caml-list] New to OCaml: can someone explain how this code can be done better? Message-ID: <20010625204007.A7057@cs.unibo.it> Mail-Followup-To: caml-list@inria.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <3B34F067.CD965358@cmu.edu> User-Agent: Mutt/1.3.18i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, Jun 23, 2001 at 03:39:19PM -0400, Eric C. Cooper wrote: > characters. As you'll see, the only imperative code is in this > conversion step; the rest is purely functional. :-(( let rec explode_string = function "" -> [] | s -> (String.get s 0) :: explode_string (String.sub s 1 (String.length s - 1)) ;; let rec implode_string = function [] -> "" | h::t -> (String.make 1 h) ^ implode_string t ;; Sorry, I can't resist :-) Cheers. -- Stefano "Zack" Zacchiroli ICQ# 33538863 Home Page: http://www.students.cs.unibo.it/~zacchiro Undergraduate student of Computer Science @ University of Bologna, Italy - Information wants to be Open - ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr