Skip to content

Instantly share code, notes, and snippets.

@mfikes
Last active February 24, 2018 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfikes/d296af1c7621d69c5b1db9323763a6ca to your computer and use it in GitHub Desktop.
Save mfikes/d296af1c7621d69c5b1db9323763a6ca to your computer and use it in GitHub Desktop.
Macro indirectly using ClojureScript library clojure.zip
(ns my.consumer
(:require [my.foo :refer [abc abc2]]))
(defn do-something []
(abc [[1 2 3] [4 [5 6] 7] [8 9]]))
(defn do-something2 []
(abc2 [[1 2 3] [4 [5 6] 7] [8 9]]))
(ns my.foo)
(defmacro abc [z]
`(make-zipper ~z))
(defmacro abc2 [z]
`(clojure.zip/zipper vector seq (fn [_# c#] c#) ~z))
(ns my.foo
(:require-macros my.foo)
(:require [clojure.zip :as z]))
(defn make-zipper [z]
(z/zipper vector? seq (fn [_ c] c) z))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment