/gist:1a69309438b44227e9ca Secret
Created
August 10, 2012 13:22
Star
You must be signed in to star a gist
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
(defmacro with-data | |
"Taken from a pull request of Clojure on GitHub. | |
Synonym of let. Use with ->> to provide binding after expressions (Haskell binding style) | |
Example: | |
(->> (+ x y) (where [x 3 y 2])) | |
which would expand to: | |
(let* [x 3 y 2] (+ x y))" | |
[& body] | |
`(let ~@body)) | |
(defmacro with-specification [& bindings] | |
`(concat ~(vec bindings) | |
all ~(vec (flatten (partition 1 2 (rest bindings)))))) | |
(->> | |
(fact (do-some-stuff-with-vars) => [my-expectations]) | |
(with-data | |
(into [] (with-specification | |
my-expectations 1 | |
b 2 | |
c 2 | |
d 4 | |
e 5))))))) | |
; Exception in thread "main" java.lang.IllegalArgumentException: clojure.core/let requires a vector for its binding in job-record.test.service.job-record-service-test: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment