Browse thread
[Caml-list] kprintf with user formatters
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-07-28 (09:36) |
From: | skaller <skaller@u...> |
Subject: | Re: lazyness in ocaml (was : [Caml-list] kprintf with user formatters) |
On Wed, 2004-07-28 at 19:13, Pierre Weis wrote: > > On Wed, 2004-07-28 at 17:26, Pierre Weis wrote: > > > > > There is nothing such as your ``substitution principle'' in Caml, > > > except if we restrict the language to truly trivial expressions (as > > > soon as expressions may incoporate basic operators such as the integer > > > addition your ``principle'' does not stand anymore). > > > > I thought: > > > > let x = expr in f x > > > > and > > > > f expr > > > > are identical in all circumstances in Ocaml > > for all terms 'expr', I must have missed > > something .. do you have a counter example? > > We have to precisely state the statement here: > > - if you mean that ``f'' is just an ident (more precisely, a > lowercase ident in the Caml parser parlance) bound to a unary > function, then the two expressions are equivalent. f is a function constant, but i didn't specify unary.. > - if f can have more than one argument, then the two expressions are > obviously not equivalent since the first one fixes the order of > evaluation when the second does not. OK, thanks. You are right. Given let x = f e in x y and (f e) y might evaluate e and y in different orders. Sorry -- you did already point this out too, i just didn't see it :) -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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