Erlang futures
Robert Virding
rv@REDACTED
Thu Apr 19 18:09:18 CEST 2001
Ulf Wiger <etxuwig@REDACTED> writes:
>But the basic idea of ets:filter/3, ets:foldl/3 et al was that they
>would be analogous to the corresponding lists functions. The
>most important reason for putting them in was that it would be
>easy to modify code that first called ets:tab2list(Tab) and
>then iterated over the result -- this being bad because it causes
>trouble for the Erlang memory handling.
Yes, but a map/fold/filter is really a function <type> -> <type> not a
function <type> -> <list>. So in lists it goes [X] -> [X] and in ets
it should go ets(X) -> ets(X) NOT ets(X) -> [X].
I quite understand why they are there, they should be there. My
comment was just that they should "return" an ets table not a list.
Considering ets itself is destructive it would be ok for
ets:map/fold/filter to also be destructive and modify the original
table. To late to change, but it is a pity.
Robert
More information about the erlang-questions
mailing list