Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@slyphon

slyphon/MOAR.clj Secret

Created March 24, 2010 21:41
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 slyphon/c969b7ac480d5d663e5e to your computer and use it in GitHub Desktop.
Save slyphon/c969b7ac480d5d663e5e to your computer and use it in GitHub Desktop.
(ns mbox.harpo.utils
(:use
[clojure.contrib
[except :only (throw-arg throw-if)]
[str-utils :only (re-split re-gsub)]
[java-utils :only (as-str)]]))
(defmacro throw-if-nil [arg & more]
`(if (nil? ~arg)
(throw-arg "argument %s must not be nil" '~arg)
(when-not (empty? (quote ~more))
(throw-if-nil ~@more))))
;; this barfs
;;
;; (let [x 1] (utils/throw-if-nil x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment