Created
October 5, 2016 23:43
-
-
Save ztellman/243a311cae5da7b9ef89fa2e23a36ee3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(defmacro if-in-str [haystack & clauses] | |
`(do | |
~@(map | |
(fn [clause] | |
(let [needle (first clause) | |
is-present-form (second clause) | |
is-not-present-form (nth clause 2 nil)] | |
`(if (> (.indexOf ~haystack ~needle) -1) | |
~is-present-form | |
~is-not-present-form))) | |
clauses))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment