Dear All,

I'm still playing around with macros and figured out a way to define a macro for list comprehension.
The syntax looks like this:

OddSquares = <<list X*X with X <- [1 2 3 4 5 6 7 8] where {IsOdd X}>>

You may use any number of generators. Every generator can be accompanied by an optional guard.

The generated code basically follows the explanation in CTM, p. 301,
i.e. consists of nested calls to lazy versions of Map and Filter.

You may download the source code here:
http://oz-code.googlecode.com/files/ListComprehension.zip
Please report bugs and problems.

Enjoy!

Wolfgang

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to