Public Vars

Back

pvalues (clj)

(source)

macro

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

Examples

frenchy64/fully-satisfies
(ns io.github.frenchy64.fully-satisfies.non-leaky-macros.clojure.core
  "Implementations of clojure.core macros that don't leak implementation details."
  (:refer-clojure :exclude [locking binding with-bindings sync with-local-vars
                            with-in-str dosync with-precision with-loading-context
                            with-redefs delay vswap! lazy-seq lazy-cat future
                            pvalues])
  (:require [clojure.core :as cc]))

(defmacro non-leaky-pvalues
  "Like clojure.core/pvalues, except exprs don't have access to recur targets."
  [& exprs]
  `(pcalls ~@(map #(list `fn [] `(let [res# ~%] res#)) exprs)))

(defmacro pvalues
  [& exprs]
  `(non-leaky-pvalues ~@exprs))