hy.contrib.walk: Add support for walking cons cells
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This commit is contained in:
parent
fa24042cb0
commit
e8dfe5bfb2
@ -32,6 +32,9 @@
|
|||||||
(outer (HyExpression (map inner form)))]
|
(outer (HyExpression (map inner form)))]
|
||||||
[(instance? HyDict form)
|
[(instance? HyDict form)
|
||||||
(HyDict (outer (HyExpression (map inner form))))]
|
(HyDict (outer (HyExpression (map inner form))))]
|
||||||
|
[(cons? form)
|
||||||
|
(outer (cons (inner (first form))
|
||||||
|
(inner (rest form))))]
|
||||||
[(instance? list form)
|
[(instance? list form)
|
||||||
((type form) (outer (HyExpression (map inner form))))]
|
((type form) (outer (HyExpression (map inner form))))]
|
||||||
[true (outer form)]))
|
[true (outer form)]))
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
(def walk-form '(print {"foo" "bar"
|
(def walk-form '(print {"foo" "bar"
|
||||||
"array" [1 2 3 [4]]
|
"array" [1 2 3 [4]]
|
||||||
"something" (+ 1 2 3 4)
|
"something" (+ 1 2 3 4)
|
||||||
|
"cons!" (cons 1 2)
|
||||||
"quoted?" '(foo)}))
|
"quoted?" '(foo)}))
|
||||||
|
|
||||||
(defn collector [acc x]
|
(defn collector [acc x]
|
||||||
|
Loading…
Reference in New Issue
Block a user