Suggestion: New table iterators

Robert Virding rv@REDACTED
Thu Oct 19 11:36:48 CEST 2000


Jakob Cederlund =?iso-8859-1?Q?på?= UAB <jakob@REDACTED> writes:
>At 10:39 2000-10-19 +0200, Bjorn Gustavsson wrote:
>>I suggest that we add
>>
>>         ets:foldl(Fun, Acc, Table)
>>         ets:foldr(Fun, Acc, Table)
>...
>
>Hmm... it's easily done, but is it the right way?
>
>...
>And it doesn't solve the initial problem, that there is no easy way for 
>isolating the algorithms on containers from the implementation of the 
>container. (Call it OOP or generic programming or whatever.)

That, fortunately or unfortunately, is the way it is with Erlang as it 
stands today.  Seeing there is no static typing there is no way for a 
compiler to work out which function it should call, you have to tell 
the system that.  Anyway, you usually know what it is.  I don't think 
the generics are that useful, but give me an example if I am wrong.

What you have abstracted out IS the basic algorithm on the containers, 
map/fold/filter whatever, and hidden the underlying implementation.  
you can fold over a list/set/ets table/mnesia table without knowing the 
low-level details of how to do it.  But you still have to know WHAT it 
is.

	Robert

-- 
Robert Virding                          Tel: +46 (0)8 545 55 017
Alteon Web Systems                      Email: rv@REDACTED
S:t Eriksgatan 44                       WWW: http://www.bluetail.com/~rv
SE-112 34 Stockholm, SWEDEN
"Folk säger att jag inte bryr mig om någonting, men det skiter jag i".





More information about the erlang-questions mailing list