Yes, that's an iterative idiom, and it doesn't take too long to
understand. Nevertheless, you still need to figure out what the loop
is doing and what it's collecting. It's not nearly as elegant or
concise as:
[x#y | x <- [1..10], y<- [1..10], x mod y = 10]
--Mark
On 3/17/06, Luis Quesada <[EMAIL PROTECTED]> wrote:
> Maximilian Wilson wrote:
> > On 3/17/06, Mark Engelberg <[EMAIL PROTECTED]> wrote:
> >
> >>Is there any sort of linguistic support for list comprehensions? I
> >>don't see anything in the manual, but it seems like the kind of thing
> >>I'd expect Mozart to have.
> >
> >
> > A quick Google search tells me that list comprehensions are a
> > combination of List.map and List.filter. I take it you want syntactic
> > sugar to cut out the fun{$} definitions?
>
> 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}
>
> Luis
>
> _________________________________________________________________________________
> mozart-users mailing list
> [email protected]
> http://www.mozart-oz.org/mailman/listinfo/mozart-users
>
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users