lfex / lutil

LFE Utility Modules (successor to lfe-utils)
Other
18 stars 8 forks source link

Add support for get-in/2 #32

Closed oubiwann closed 9 years ago

oubiwann commented 9 years ago

A la Clojure's get-in function.

Support the following types by atom keys

Support the following types by integer indices:

This blocks the following:

oubiwann commented 9 years ago

Lovely: for nested lists, it's just this simple:

(lists:foldl #'lists:nth/2 data indices))
oubiwann commented 9 years ago

And for nested proplists, just as beautiful:

(lists:foldl #'proplists:get_value/2 data keys)
oubiwann commented 9 years ago

Released as part of 0.6.1.