caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <weis@pauillac.inria.fr>
To: calla@matpts.univ-poitiers.fr (CALLADINE Pierre)
Cc: caml-list@pauillac.inria.fr
Subject: Re: boolean operators
Date: Thu, 8 Jun 1995 18:34:37 +0200 (MET DST)	[thread overview]
Message-ID: <199506081634.SAA29211@pauillac.inria.fr> (raw)
In-Reply-To: <9506081217.AA02365@matpts.univ-poitiers.fr> from "CALLADINE Pierre" at Jun 8, 95 12:17:13 pm

> 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
----------------------------------------------------------------------------




      reply	other threads:[~1995-06-08 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-06-08 13:17 CALLADINE Pierre
1995-06-08 16:34 ` Pierre Weis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199506081634.SAA29211@pauillac.inria.fr \
    --to=weis@pauillac.inria.fr \
    --cc=calla@matpts.univ-poitiers.fr \
    --cc=caml-list@pauillac.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).