[Oz] Loop extensions

Peter Van Roy pvr at info.ucl.ac.be
Fri Feb 9 18:31:18 CET 2001


I have just used the loop extensions to write a version of the
Floyd-Warshall transitive closure algorithm as an example declarative
program in the draft Mozart book. I just want to say how much I like
this particular form of syntactic sugar, in particular the 'collect'
which is *extremely* convenient.  I just have two minor comments:

1. It would be nice to be able to say:

   for A|B in L..H do ... end

   instead of:

   for X in L..H do A|B in ... end

2. It might be nice to have a difference list version
   of the 'append' accumulator.  This is faster and
   consumes less memory.

Neither is needed for the upcoming release, of course. There are other
possible extensions, but I don't feel the need right now:

- Multiple named accumulators.

- A user-defined accumulation function.

- Ability to 'compose' accumulators.

I did feel the need for these in a past life (see the 'Logical State
Threads' package for SICStus Prolog), when in my youthful innocence I
was writing large 'pure' Prolog programs.  But having explicit state
makes these less useful.

Peter Van Roy
-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.





More information about the mozart-users mailing list