-
-
Save slyphon/c969b7ac480d5d663e5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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