From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA16552 for caml-red; Thu, 14 Dec 2000 19:20:46 +0100 (MET) 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 DAA09015 for ; Wed, 13 Dec 2000 03:47:19 +0100 (MET) Received: from smtp3-cm.mail.eni.net (smtp3a-cm.mail.eni.net [216.133.226.136]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eBD2lIf23269 for ; Wed, 13 Dec 2000 03:47:18 +0100 (MET) Received: from checkerlap.d6.com ([216.233.204.162]) by smtp3-cm.mail.eni.net (8.9.3/8.9.3) with ESMTP id SAA04917; Tue, 12 Dec 2000 18:47:09 -0800 Message-Id: <4.3.2.7.2.20001212183029.00c6db60@shell16.ba.best.com> X-Sender: def6@shell16.ba.best.com X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Tue, 12 Dec 2000 18:35:11 -0800 To: John Prevost , eijiro_sumii@anet.ne.jp From: Chris Hecker Subject: Re: substring match like "strstr" Cc: caml-list@inria.fr, gerd@gerd-stolpmann.de, sumii@venus.is.s.u-tokyo.ac.jp In-Reply-To: <87ofyhw2dy.fsf@elbereth.pgh.arsdigita.com> References: <20001212122807K.sumii@yl.is.s.u-tokyo.ac.jp> <00120814135508.00625@ice> <20001210221657W.sumii@yl.is.s.u-tokyo.ac.jp> <4.3.2.7.2.20001211103237.00c12100@shell16.ba.best.com> <20001212122807K.sumii@yl.is.s.u-tokyo.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: weis@pauillac.inria.fr >The file strstr.c is included below for your edification. I'd argue >that any Caml version is likely to a be a wee bit easier to >understand. Okay, so here's a new challenge: write the most readable strstr you can in ocaml. The restriction is you have to actually implement the algorithm, not just call the regex library. :) What is the most functional and readable one we can come up with? And then we'll compare its performance and see if the readable/performance curve is appropriate. Eijiro's was relatively short and functional, but still not completely transparent. My imperative one sucks for readability because of all the references and variables. Chris