[clean-list] List Comprehensions...

Ronny Wichers Schreur ronny@cs.kun.nl
Fri, 15 Dec 2000 16:05:21 +0100


Fabien Todescato asks:

> Are list comprehensions compiled using flatten, map,
> filter, ... functions, or are they compiled using a
> continuation-based logic ?

The comprehensions are translated to nested functions for
nested comprehensions. No intermediate structures are build.
See paragraph 9.3.2 in Functional Programming and Parallel
Graph Rewriting (Plasmeijer and Van Eekelen 1993).

The transformation would be simpler if you could generate
the flatten, etc version and let deforestation take care
of the rest. However, Clean 1.3.3 doesn't do deforestation
and array generators and comprehensions complicate matters
significantly.



Cheers,

Ronny Wichers Schreur