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 WAA15159; Wed, 21 Jul 2004 22:44:25 +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 WAA15414 for ; Wed, 21 Jul 2004 22:44:24 +0200 (MET DST) Received: from ptb-relay03.plus.net (ptb-relay03.plus.net [212.159.14.214]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6LKiNEV007422 for ; Wed, 21 Jul 2004 22:44:23 +0200 Received: from [80.229.56.224] (helo=chetara) by ptb-relay03.plus.net with esmtp (Exim) id 1BnNwq-000P06-K1 for caml-list@inria.fr; Wed, 21 Jul 2004 20:44:20 +0000 From: Jon Harrop To: caml-list@inria.fr Subject: Re: [Caml-list] kprintf with user formatters Date: Wed, 21 Jul 2004 21:41:45 +0100 User-Agent: KMail/1.6.2 References: <200407211552.RAA04351@pauillac.inria.fr> In-Reply-To: <200407211552.RAA04351@pauillac.inria.fr> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200407212141.45191.postmaster@jdh30.plus.com> X-Miltered: at nez-perce with ID 40FED5A7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; postmaster:99 caml-list:01 kprintf:01 formatters:01 2004:99 pierre:01 weis:01 expr:01 expr:01 realised:01 lazily:01 predicates:01 implemented:01 vanilla:01 distinctions:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wednesday 21 July 2004 16:52, Pierre Weis wrote: > Yes this remark is completely relevant: I knew it. ;-) > the built-in && and || > operators and the if then else construct (considered as a 3 places > operator) are the only lazy constructs of the language. Is "match pred with true -> expr1 | false -> expr2" not equivalent to "if pred then expr1 else expr2"? If so, isn't pattern matching a fourth lazy construct? Just after I wrote that last post I realised that this approach could actually be useful in numerical contexts. As a trivial example, integer multiply could lazily evaluate its second argument (only when it is pure, if conventional semantics are to be preserved), not needing it if the first argument is zero. This may be useful in more complicated settings, i.e. when dealing with data structures rather than primitive types and when predicates over the data structure can be evaluated much more quickly than the corresponding expression. Such functionality can, of course, be implemented in vanilla OCaml. But I'd like to see a language which allowed mathematics to be expressed in a notation as close to conventional written form as possible (although I prefer type distinctions, like "+" vs "+.") whilst retaining efficiency (I'd also like to see deforesting, e.g. in vector expressions without having to resort to maps, folds etc.). Perhaps an OCaml -> OCaml optimising compiler would be a good project for someone? That way implementation details and their benefits can be examined without having to touch the OCaml compilers. I think it could be quite fun to play with such a thing... Cheers, Jon. ------------------- 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