title: How do I convert "generic" expressions into asserted predicate expressions? (Clojure)
body: <p>I am attempting to write a macro that converts "generic" expressions into expressions evaluated for a particular given value.</p>
  
  <p>Let us say that I have a vector of unevaluated expressions of the form,</p>
  
  <pre><code>'[(map? %)                          
    (-&gt; % :value string?)             
    (fn[x] (apply #(pos? %) (- x 2))] 
  </code></pre>
  
  <p>I have a gensymed value v, that I wish to "pass" to the above expression at runtime. So, assume that v will be the name of the symbol used at compile time. I also wish to assert the converted expression. Basically, for the example above, I wish to convert the above vector expression into the form below. Note that I am passing the value v to % in the first two expressions, and to x in the third expression. The code below isn't correct, but only illustrates what I want to happen. I have no idea how to actually get v into any of the below expressions assertions.</p>
  
  <pre><code>'[(assert (map? %))                           ;; % is equal to v
    (assert (-&gt; % :value string?))              ;; % is equal to v
    (assert (fn[x] (apply #(pos? %) (- x 2)))]  ;; x is equal to v
  </code></pre>
  
  <p>As a guiding example, I wish to be able to do what the :post part of a prepost-map? does on a defn expression. Any help is appreciated.</p>