[Oz] Loop extensions

Peter Van Roy pvr at info.ucl.ac.be
Mon Feb 12 10:51:57 CET 2001


> Hi Peter,
> thanks for the appreciation.
> 
> > 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
> 
> I don't understand what you mean here.  If you meant to write:
> 
>         for A|B in L do ... end
> 
> then you can already write this (assuming L is a list whose elements
> are conses).  You can use an arbitrary pattern instead of just a
> running variable.

Sorry, my code had a typo.  What I meant was (using '#' to avoid any
confusion with conses):

  declare
  L=[2#3 3#4 4#5] in
  for A#B in L do {Show A#B} end

This doesn't work in either version of Mozart I tried (release +
upcoming release), whereas the following does work:

  declare
  L=[2#3 3#4 4#5] in
  for X in L do {Show X} end

Peter

-
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