[erlang-questions] How to return first {Key, Value} from Map where Predicate is true

Imants Cekusins imantc@REDACTED
Thu Jan 8 18:46:15 CET 2015


An iterator function with a break option would be very useful, too.

Even the current maps:fold function could be modified to allow break:

fold(Fun, Init, Map) -> Acc

Types:

Fun = fun((K, V, AccIn) -> AccOut)

modify to:
Fun = fun((K, V, AccIn) -> AccOut | {break, AccOut})

?



More information about the erlang-questions mailing list