Skip to content
Browse files

First piece of hoc

  • Loading branch information...
1 parent b7e931a commit 0a113317d05d659c1607cbac719dcc93d860b9c1 @fogus fogus committed Jul 23, 2012
View
7 src/main/clojure/clojure/core/contracts.clj
@@ -12,6 +12,13 @@
{:docstring ~docstring
::constraints :TBD}))
+(defmacro _
+ [a b & body]
+ (let [name (if (symbol? a) a (gensym "hoc"))
+ args (if (symbol? a) b a)
+ body (if (symbol? a) body (list* b body))]
+ `(contract ~name "TBD" ~args ~(vec body))))
+
(defn with-constraints
"A contract combinator.
View
1 src/main/clojure/clojure/core/contracts/impl/transformers.clj
@@ -80,3 +80,4 @@
(->> cnstr-descrs
build-contract-bodies
(list* `fn name))))
+

0 comments on commit 0a11331

Please sign in to comment.
Something went wrong with that request. Please try again.