Open justjoheinz opened 6 days ago
I ever thought that, but I wasn't sure if it was useful since it's easily achieved by cl:reduce
like this:
(defvar *alist* '((:a . ((:b . ((:c . :d)))))))
(reduce #'aget '(:a :b :c) :initial-value *alist*)
;=> :D
But you can't get the nth element for example. the reduce example is nice though.
True. I noticed it by your example. I'm waiting for coming up a good function name.
As you already took inspiration from cl-hash-util - what about implementing the
(hash-get obj '("user" "friends" 0 "name"))
function to retrieve a chain of values.I implemented that in a simple manner without lots of checking and couldn't come up with a suitable name yet.
Given an alist like :
one can do: