Namespaces

 

with-constraints

fogus.me.trammel

  • (with-constraints f)
  • (with-constraints f c)
  • (with-constraints f c & more)
A contract combinator.

Takes a target function and a number of contracts and returns a function with the contracts
applied to the original. This is the preferred way to apply a contract previously created
using `contract` as the use of `partial` may not work as implementation details change.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source fogus/me/trammel.clj:143 top

(defn with-constraints
  "A contract combinator.
   
   Takes a target function and a number of contracts and returns a function with the contracts
   applied to the original.  This is the preferred way to apply a contract previously created
   using `contract` as the use of `partial` may not work as implementation details change.
  "
  ([f] f)
  ([f c] (partial c f))
  ([f c & more]
     (apply with-constraints (with-constraints f c) more)))
Vars in fogus.me.trammel/with-constraints: defmacro list concat partial seq apply defn
Used in 0 other vars

Comments top

No comments for with-constraints. Log in to add a comment.