From 2f03a992d00b97c1f7e354fff32174b4c1edd1d8 Mon Sep 17 00:00:00 2001 From: Fogus Date: Fri, 4 Jun 2010 14:38:19 -0400 Subject: [PATCH] added a simple with-contracts macro that composes a string of contracts with a root contractee function --- src/fogus/me/trammel.clj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/fogus/me/trammel.clj b/src/fogus/me/trammel.clj index bf9f5c0..c749a9b 100644 --- a/src/fogus/me/trammel.clj +++ b/src/fogus/me/trammel.clj @@ -25,6 +25,12 @@ (rest forms) forms))))) +(defmacro with-contracts + ([f] f) + ([f contract] (list 'partial contract f)) + ([f contract & more] + `(with-contracts (with-contracts ~f ~contract) ~@more))) + (defmacro defconstrainedfn [name & body] (let [mdata (if (string? (first body))