List Comprehensions?
Grégoire Dooms
dooms at info.ucl.ac.be
Sat Mar 18 10:28:15 CET 2006
Luis Quesada wrote:
> How about using collect
> (http://www.mozart-oz.org/documentation/loop/node2.html#label5)?
>
> This is how I would browse the list of tuples I#J such that 1=<I,J=<10
> and I mod J =0:
>
> {Browse
> for I in 1..10 collect:C do
> for J in 1..10 do
> if I mod J==0 then {C I#J} end
> end
> end}
>
List comprehension would be some syntactic sugar like this:
{Browse [I#J for I in 1..10 for J in 1..10 if I mod J==0] }
I don't think this could be implemented as a macro.
Best,
--
Grégoire Dooms.
More information about the mozart-users
mailing list