Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(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)
(->> (+ 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])
(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
You can’t perform that action at this time.