Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: [Caml-list] eval order and 'and'
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-11 (08:32)
From: Hendrik Tews <tews@t...>
Subject: Re: [Caml-list] eval order and 'and'
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
   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
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).


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: