Suggestion: New table iterators

Ulf Wiger <>
Thu Oct 19 11:39:28 CEST 2000

On Thu, 19 Oct 2000, Robert Virding wrote:

>The problem with using lc is that you are explicitly building a list
>of values, you are going Table -> List.  This abuses the lc notion,

But a list comprehension over ets is not that much different from a
mnemosyne query on mnesia. Mnemosyne also goes Table -> List.

An option would be to extend mnemosyne (not standard LC) to also
operate on ets tables. This brings us into the area of "dirty
mnemosyne", which we at AXD 301 have suggested in the past - and then
had to duck for cover. ;)

>I think the fold function is MUCH better as it can do all the LC
>can, plus much more.  The intent is also clearer.

Is this a general critique against LC? (:

Returning to (my) original problem of changing data storage options
with minimal impact to the code, it should be possible to use LCs over
tables (ets or mnesia) as well as over lists. The same goes with the
high-level iterator functions in lists.

Regarding LC vs. fold functions, I've noticed that some people seem to
much prefer one or the other. Some love list comprehensions and hate
foldl; others enjoy the lists functions, but don't like LCs; yet
others hate them both and want to write their own iterations using
list syntax. 

Personally, I love them all equally. (:

Ulf Wiger                                    tfn: +46  8 719 81 95
Strategic Product & System Management        mob: +46 70 519 81 95
Ericsson Telecom AB,              Datacom Networks and IP Services
Varuvägen 9, Älvsjö,                    S-126 25 Stockholm, Sweden

More information about the erlang-questions mailing list