caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] eval order and 'and'
Date: Wed, 11 Sep 2002 10:32:34 +0200 (CEST)	[thread overview]
Message-ID: <15742.65442.172923.514962@gargle.gargle.HOWL> (raw)
In-Reply-To: <20020911074753.GA1315@iliana>

Sven LUTHER writes:
   Date: Wed, 11 Sep 2002 09:47:53 +0200
   Subject: Re: [Caml-list] eval order and 'and'
   
   So he can do things like :
   
   if x <> 0 and 1 / x ... 
   
   like it is possible to do in C, instead of doing :
   
   if x <> 0 then if 1 / x ...
   
   which gives more lines of code, and needs to redefine two time the else
   condition.
   
   Anyway, i don't think the order is defined, but in any case, i guess
   it would be revere sequential if anything (execution starts from the
   right).
   
IMO you are mixing things up, "and" is not an operator and 

   if x <> 0 and 1 / x ... 

is not legal ocaml. 

For let a = ex1 and b = ex2 ... the manual says that the
evaluation is unspecified (6.7.1. local definitions).

For the logical operators (&&, &, ||, or) the manual specifies left
to right (non-strict) evaluation (Module Pervasives).

Bye,

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


  reply	other threads:[~2002-09-11  8:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-11  5:05 Arturo Borquez
2002-09-11  7:19 ` Chris Hecker
2002-09-11  7:47 ` Sven LUTHER
2002-09-11  8:32   ` Hendrik Tews [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-09-11  1:21 Chris Hecker
2002-09-11  7:30 ` malc

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=15742.65442.172923.514962@gargle.gargle.HOWL \
    --to=tews@tcs.inf.tu-dresden.de \
    --cc=caml-list@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).