[gambit-list] Marc, does Gambit evaluate left-to-right order always or only generally?

Marc Feeley feeley at iro.umontreal.ca
Sat Nov 18 07:56:36 EST 2017


In Scheme it is allowed that the oder of evaluation of A, B, C, …, G is permuted arbitrarily.  The calls (B …) and (E …) can also happen in any order, but obviously after their respective arguments are evaluated.  And the call (A …) can only happen after both calls (B …) and (E …).

It is hard for me to say if this ordering liberty is used by the compiler.  So don’t rely on any particular ordering.

Marc



> On Nov 18, 2017, at 3:32 AM, Adam <adam.mlmb at gmail.com> wrote:
> 
> Evaluation is always separated between procedure calls though, so the undefined order only regards specifically the order in which the operator and arguments are evaluated, right?
> 
> (
> E.g.:
> 
> For the code (A (B C D) (E F G)), let's call (B C D) X1 and (E F G) X2, here: While the evaluation order within the block B C D, and within the block E F G, and within the block A X1 X2, is undefined, the internal evaluation of X1 and X2 is never mixed so that you'd get an evaluation order B to F to D, right?
> 
> Any mix where A, X1, X2 are kept separate could happen thoug, e.g. A, C, B, D, F, E, G or F, E, G, D, B, C, A.
> )
> 
> 2017-11-14 10:03 GMT+08:00 Marc Feeley <feeley at iro.umontreal.ca>:
> Left as an exercice to the reader…
> 
> Marc
> 
> 
> 
> > On Nov 13, 2017, at 10:37 AM, Adam <adam.mlmb at gmail.com> wrote:
> >
> > Wow.
> >
> > Can you give an actual code exampe where compiled (or interpreted) code not does left to right?
> >
> > I think all I observed in practice in the past was left to right.
> >
> > Adam
> >
> >
> > 2017-11-13 21:45 GMT+08:00 Marc Feeley <feeley at iro.umontreal.ca>:
> > Execution order is arbitrary.  The interpreter and compiler don’t use the same ordering.  The interpreter tends to be mostly left-to-right, but don’t count on it.
> >
> > Marc
> >
> >
> >
> > > On Nov 12, 2017, at 4:19 PM, Adam <adam.mlmb at gmail.com> wrote:
> > >
> > > Hi Marc!
> > >
> > > Does Gambit evaluate left-to-right order always or only generally?
> > >
> > > Thanks,
> > > Adam
> >
> >
> 
> 




More information about the Gambit-list mailing list