Re: order of evalutation of ||

1998-05-29 Thread Martin Norbäck
-BEGIN PGP SIGNED MESSAGE- On Thu, 28 May 1998, S. Alexander Jacobson wrote: > If you have a statement like: > > result= a || b || c > > does Haskell guarantee that a gets evaluated before b? > If it does then I only have to protect against pattern match failure in > one place, a. Ye

Re: order of evalutation of ||

1998-05-29 Thread Arjan van Ijzendoorn
Hello Alexander, > If you have a statement like: > > result= a || b || c It is better to speak of 'declarations'. There are no statements in Haskell. > does Haskell guarantee that a gets evaluated before b? Yes, it does. You can think of (||) being defined as: (||) :: Bool -> Bool -> Bool Tr

Re: order of evalutation of ||

1998-05-29 Thread Simon L Peyton Jones
> > If you have a statement like: > > result= a || b || c > > does Haskell guarantee that a gets evaluated before b? > If it does then I only have to protect against pattern match failure in > one place, a. Yes; if a is true, b and c won't be evaluated. That's part of the defn of || Simon

order of evalutation of ||

1998-05-29 Thread Alex Ferguson
S. Alexander Jacobson wonders: > If you have a statement like: > > result= a || b || c > > does Haskell guarantee that a gets evaluated before b? Indeed it does, for see the standard Prelude definition of (||): True || _ = True False || x = x Hope that helps. Slainte, Alex.

order of evalutation of ||

1998-05-28 Thread S. Alexander Jacobson
If you have a statement like: result= a || b || c does Haskell guarantee that a gets evaluated before b? If it does then I only have to protect against pattern match failure in one place, a. -Alex- ___ S. Alexander Jacobson