Raphael Collet wrote:
Grégoire Dooms wrote:
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.
Not with macros a la C. But with advanced macros (a la Common Lisp),
this is perfectly possible. We have a student working on such macros.
And he already has some promizing results.
I will ask him if he can handle something like
list I#J with I in 1..10 J in 1..10 where I mod J==0 end
which is a bit more Oz-like syntax.
It would be also interesting to take into account parallel list
comprehension and recursive list comprehension in order to be able to
write things like the following:
%% Binding FacNumbers to the first 10 factorial numbers
FacNumbers=1|for F in FacNumbers I in 2..9 collect:C do
{C F*I}
end
This currently does not work because the list is not returned
incrementally. In fact, I wonder why it is not.
Luis
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users