Skip to content

Instantly share code, notes, and snippets.

@sorenmacbeth
Created November 3, 2016 23:12
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 sorenmacbeth/0b0a49dff6e01879de986a0b0c89a604 to your computer and use it in GitHub Desktop.
Save sorenmacbeth/0b0a49dff6e01879de986a0b0c89a604 to your computer and use it in GitHub Desktop.
(defn hinted-iterator [x]
(.iterator ^java.lang.Iterable x))
(defmacro iterator-fn
[& body]
(let [[args & biz] body
it-biz (cons 'hinted-iterator biz)
it-body (cons args (list it-biz))]
`(fn ~@it-body)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment