Public Vars

Back

lazy-cat (clj)

(source)

macro

(lazy-cat & colls)
Expands to code which yields a lazy sequence of the concatenation of the supplied colls. Each coll expr is not evaluated until it is needed. (lazy-cat xs ys zs) === (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))

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-lazy-cat
  "Like clojure.core/lazy-cat, except body does not have access to a recur target."
  [& colls]
  `(concat ~@(map #(list `non-leaky-lazy-seq %) colls)))

(defmacro lazy-cat
  [& args]
  `(non-leaky-lazy-cat ~@args))