From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id SAA29280 for caml-redistribution; Thu, 8 Jun 1995 18:36:03 +0200 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id SAA29211; Thu, 8 Jun 1995 18:34:37 +0200 From: Pierre Weis Message-Id: <199506081634.SAA29211@pauillac.inria.fr> Subject: Re: boolean operators To: calla@matpts.univ-poitiers.fr (CALLADINE Pierre) Date: Thu, 8 Jun 1995 18:34:37 +0200 (MET DST) Cc: caml-list@pauillac.inria.fr In-Reply-To: <9506081217.AA02365@matpts.univ-poitiers.fr> from "CALLADINE Pierre" at Jun 8, 95 12:17:13 pm X-Mailer: ELM [version 2.4 PL21] Content-Type: text/plain Sender: weis > Is there a deep (or theoretical) reason for the particular status > of boolean operators as "&" and "or" > ( "prefix &" is not valid, for instance ?) The problem is that there are no corresponding functions in Caml: these syntactic constructs are equivalent to an if then else expression, not to a function call to some primitive operation (as for + for example). On the other hand, since Caml evaluation obeys call by value, there is no means to define a function that does not evalute its arguments. Hence you cannot define a function f such that e1 & e2 could be equivalent to f e1 e2. In effect, when e1 evaluates to false, the construct e1 & e2 returns false and e2 is not evaluated. By contrast, the call f e1 e2 may return some value but e2 will be evaluated before entering the body of f. Put it another way, & is a lazy construct: if e2 fails or does not terminate then false & e2 evaluates to false, while any function call with e2 as argument will fail or loop. Pierre Weis ---------------------------------------------------------------------------- WWW Home Page: http://pauillac.inria.fr/~weis Projet Cristal INRIA, BP 105, F-78153 Le Chesnay Cedex (France) E-mail: Pierre.Weis@inria.fr Telephone: +33 1 39 63 55 98 Fax: +33 1 39 63 53 30 ----------------------------------------------------------------------------