[plt-scheme] Re: to define, or to let (last try)

From: Andre van Tonder (andre at het.brown.edu)
Date: Tue Apr 27 13:45:44 EDT 2004

On Tue, 27 Apr 2004, Paul Schlie wrote:

> - still waiting to see someone produce a explicit code fragment which
>   demonstrates the value of unspecified evaluation order, as many counter
>   examples have already been produced. If none can be produced, then maybe
>   it's perceived merits should be reconsidered.

In this regard, let me quote Simon Peyton Jones "Wearing the Hair Shirt -
A restrospective on Haskell".  I see it as somewhat relevant to the
discussion:

SPJ:

> Which would you prefer? 
>   do a <-f x           OR       h (f x) (g y)
>      b <-g y 
>      h a b      
> 
> In a commutative monad, it does not matter whether we do (f x) first or
> (g y).
> Commutative monads are very common. (Environment, unique supply, random
> number generation.) 
> For these, monads over-sequentialise. Wanted: theory
> and notation for some cool compromise.

Currently Scheme's unspecified evaluation order indeed gives us a way to
notationallly distinguish computations whose side effects are commutative
in exactly this sense.  Examples as suggested by SPJ above are

   (+ (random) (random))

   (list (gensym) (gensym) (gensym))

etc.  

       






Posted on the users mailing list.