guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About the primitive macros `and' and `or'


From: Yi DAI
Subject: Re: About the primitive macros `and' and `or'
Date: Fri, 25 Dec 2009 16:20:38 +0800



On Fri, Dec 25, 2009 at 4:21 PM, Klaus Schilling <address@hidden> wrote:

As a function, gor needs to have its arguments evaluated before the
actual application takes place, moreover, the order of evaluation is
not specified.

Hence

(define x 0)
(gor (= x 0) (/ x))

gives a numerical overflow error,
whereas

(define x 0)
(or (= x 0) (/ x))

returns true.

If the terms to be evaluated contain non-commutable side effects,
things get out of control, whereas in the macro `or', you may rely on
the order of the side effects.


Yes, Klaus. I forgot that Scheme adopts applicative-order evaluation (after experiencing Haskell for quite a while). 

I do see the necessity of your proposal for normal-order evaluation as default, Stephen, ;)



--
DAY

reply via email to

[Prev in Thread] Current Thread [Next in Thread]