Skip to content

Instantly share code, notes, and snippets.

@MayDaniel
Created December 14, 2010 17:21
Show Gist options
  • Select an option

  • Save MayDaniel/740734 to your computer and use it in GitHub Desktop.

Select an option

Save MayDaniel/740734 to your computer and use it in GitHub Desktop.
(defmacro check-let [bindings & body]
(assert (vector? bindings))
(assert (even? (count bindings)))
(if (not-empty bindings)
(let [[binding [else & more]] (split-at 2 bindings)]
`(if-let [~@binding] (check-let [~@more] ~@body) ~else))
`(do ~@body)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment