by beeworker · 11y ago · 0 comments
(def x ((((5 4 3 2 1) 6) 7) 8 9))
(get-in x (0 0 0 1))
Probably botched quoting, don't know common lisp, only clojure. (let ((x '((((5 4 3 2 1) 6) 7) 8 9)))
(syntax->datum
(syntax-case x ()
((((_ p) _) _ ...) #'p))))Some examples (from Haskell):
>>> ((((5,4,3,2,1),6),7),8,9) & view (_1 . _1 . _2)
6
>>> ((((5,4,3,2,1),6),7),8,9) & (_1 . _1 . _2) .~ 4
((((5,4,3,2,1),4),7),8,9)
>>> let foo = ((((5,4,3,2,1),6),7),8,9)
>>> foo & view (_1 . _1 . _2)
6
>>> let six = _1 . _1 . _2
>>> foo & view six
6
>>> foo & six .~ 4
((((5,4,3,2,1),4),7),8,9)
>>> foo & six .~ "abc"
((((5,4,3,2,1),"abc"),7),8,9)