Public Vars

Back

pcalls (clj)

(source)

function

(pcalls & fns)
Executes the no-arg fns in parallel, returning a lazy sequence of their values

Examples

typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
  "Type annotations for the base Clojure distribution."
  #?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
  (:require [clojure.core :as cc]
            [typed.clojure :as t]
            #?(:clj [typed.ann-macros.clojure :as macros])
            #?(:clj typed.ann.clojure.jvm) ;; jvm annotations
            #?(:clj clojure.core.typed))
  #?(:clj
     (:import (clojure.lang PersistentHashSet PersistentList
                            APersistentMap #_IPersistentCollection
                            #_ITransientSet
                            IRef)
              (java.util Comparator Collection))))

cc/map (t/All [c a b :..] (t/IFn [[a :-> c] :-> (t/Transducer a c)]
                                 [[a b :.. b :-> c] (t/NonEmptySeqable a) (t/NonEmptySeqable b) :.. b :-> (t/NonEmptyASeq c)]
                                 [[a b :.. b :-> c] (t/Seqable a) (t/Seqable b) :.. b :-> (t/ASeq c)]))
cc/mapv (t/All [c a b :..] (t/IFn [[a b :.. b :-> c] (t/NonEmptySeqable a) (t/NonEmptySeqable b) :.. b :-> (t/NonEmptyAVec c)]
                                  [[a b :.. b :-> c] (t/Seqable a) (t/Seqable b) :.. b :-> (t/AVec c)]))
cc/mapcat (t/All [c a b :..] (t/IFn
                               [[a :-> (t/Seqable c)] :-> (t/Transducer a c)]
                               [[a b :.. b :-> (t/Seqable c)] (t/Seqable a) (t/Seqable b) :.. b :-> (t/ASeq c)]))
cc/cat (t/All [x] (t/Transducer (t/Seqable x) x))
#?@(:cljs [] :default [
cc/pmap (t/All [c a b :..] (t/IFn [[a b :.. b :-> c] (t/NonEmptySeqable a) (t/NonEmptySeqable b) :.. b :-> (t/NonEmptyASeq c)]
                                  [[a b :.. b :-> c] (t/Seqable a) (t/Seqable b) :.. b :-> (t/ASeq c)]))
cc/pcalls (t/All [r] [[:-> r] :* :-> (t/ASeq r)])
])
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)))