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 CAA17042; Mon, 6 Sep 2004 02:57:43 +0200 (MET DST) 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 CAA15989 for ; Mon, 6 Sep 2004 02:57:42 +0200 (MET DST) Received: from annexia.force9.co.uk (annexia.force9.co.uk [212.56.101.183]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i860vg1q011849 for ; Mon, 6 Sep 2004 02:57:42 +0200 Received: from rich by annexia.force9.co.uk with local (Exim 3.36 #1 (Debian)) id 1C47pF-0005Lx-00 for ; Mon, 06 Sep 2004 01:57:41 +0100 Date: Mon, 6 Sep 2004 01:57:41 +0100 Cc: caml-list Subject: Re: [Caml-list] laziness Message-ID: <20040906005741.GA20406@annexia.org> References: <413879B6@webmail> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sdtB3X0nJg68CQEu" Content-Disposition: inline In-Reply-To: <413879B6@webmail> User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones X-Miltered: at nez-perce with ID 413BB606.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 strictness:01 bug:01 bug:01 haskell:01 squares:01 squares:01 troll:01 ltd:98 semantics:01 semantics:01 ocaml:01 05,:01 sep:01 X-Attachments: type="application/pgp-signature" name="signature.asc" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk --sdtB3X0nJg68CQEu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 05, 2004 at 01:07:48PM +1200, Jason Smith wrote: > There are several locations where we may attempt to reduce this overhead. > > Strictness analysis: Determines usuing some form of abstract > reduction semantics weather the argument is "strict" in the > function, i.e. that it will be used at all. If it isn't then there > is no need to reduce it. The problem with this is that in O'Caml u > once again have side-effect's raise there ugly head. This means that > even if the argument is not used in the function, the results of > evaluating the argument which uses side-effects is. So you may have > to analyse the argument itself and see if it uses any reference > semantics. One thing that worries me about laziness. Doesn't laziness often indicate a bug in the code? ie. You've written an expression in the program, but that expression is never used. This is dead code, right? Hence a bug? The only thing I can think of which countradicts this case is the common Haskell example of the "infinite" list: numbersFrom n =3D n : numbersFrom (n+1) squares =3D map (^2) (numbersFrom 1) take 10 squares But in a sense this contains dead code too. You've written down your desire to construct all the squares, and then later you change your mind and take only the first 10. In OCaml you'd write this correctly as something like: List.map (fun x -> x * x) (range 1 10) (Sorry if this appears like a troll, but actually I'm genuinely interested in whether laziness is useful, or indicates a bug). Rich. --=20 Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment MONOLITH is an advanced framework for writing web applications in C, easier than using Perl & Java, much faster and smaller, reusable widget-based arch, database-backed, discussion, chat, calendaring: http://www.annexia.org/freeware/monolith/ --sdtB3X0nJg68CQEu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFBO7YF4le1M6q9pzoRAkxyAJ9cyyXmaoNj6NLDxrmnb1HmdcYY8QCfezPe trpNhurTG7UCKU4AK3oQkPs= =A3GF -----END PGP SIGNATURE----- --sdtB3X0nJg68CQEu-- ------------------- 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