[erlang-questions] Getting the position of a list item
Attila Rajmund Nohl
attila.r.nohl@REDACTED
Wed Dec 2 19:44:40 CET 2009
2009/12/2, Garrett Smith <g@REDACTED>:
[...]
> But if a 20 year old language can get by without these, then by
> definition *I'm* wrong :)
Well, actually I think in this case Erlang is wrong. There was a
thread here a couple of months ago that some (most?) libraries on OTP
were developed more in an "evolutionary" way, not "intelligently
designed". For example the string module has substr and sub_string,
because the module was merged from two previous string modules. Lookup
functions have different interfaces:
ets:lookup(Table, Key) -> [Objects]
dict:find(Key, Dict) -> {ok, Value} | error
gb_tree:lookup(Key, Tree) -> {value, Val} | none
lists:keysearch(Key, N, TupleList) -> {value, Tuple} | false
proplists:lookup(Key, List) -> none | tuple()
Our local proplist:lookup-clone function returns no_value where
proplists would return none. Expect the unexpected, when you work with
Erlang libraries.
More information about the erlang-questions
mailing list