Created
May 7, 2016 09:13
-
-
Save werelax/bf28190efc0e081637b0ac7d28848f48 to your computer and use it in GitHub Desktop.
Common Lisp utilities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro getf-in (list &rest keys) | |
(reduce (lambda (acc el) `(getf ,acc ,el)) | |
keys :initial-value list)) | |
;; example | |
(defparameter jarl '(:a 1 :b 2 :c (:d (:e "yeah")))) | |
(getf-in jarl :c :d :e) ; => "yeah" | |
(setf (getf-in jarl :c :d :e) "something else") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment