pvalues

clojure.core

  • (pvalues & exprs)
Returns a lazy sequence of the values of the exprs, which are
evaluated in parallel

2 Examples top

  • ;; expressions are calculated in parallel
    
    user=> (pvalues (expensive-calc-1) (expensive-calc-2))
    (2330 122)
    
  • ;; pvaules is implemented using Clojure futures.  See examples for 'future'
    ;; for discussion of an undesirable 1-minute wait that can occur before
    ;; your standalone Clojure program exits if you do not use shutdown-agents.
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:6124 top

(defmacro pvalues
  "Returns a lazy sequence of the values of the exprs, which are
  evaluated in parallel"
  {:added "1.0"
   :static true}
  [& exprs]
  `(pcalls ~@(map #(list `fn [] %) exprs)))
Vars in clojure.core/pvalues:
Used in 0 other vars

Comments top

No comments for pvalues. Log in to add a comment.