[erlang-questions] working with sets
Vance Shipley
vances@REDACTED
Fri Jan 4 13:52:21 CET 2008
On Fri, Jan 04, 2008 at 07:11:37AM -0500, Vance Shipley wrote:
} My only dissatisfaction is that I don't have a lazy way
} to find the first set in the set of sets which contains
} an element. I'm all about lazy evaluation.
I can of course do so easily using ordsets 'cause I 'm allowed
to know what the representation of the sets are. It's just not
portable to other set implementations.
get_set(Elem, [H|T]) ->
case ordsets:is_element(Elem, H) of
true ->
ordsets:to_list(H);
false ->
get_set(Elem, T)
end.
-Vance
More information about the erlang-questions
mailing list