Back

coll-fold (clj)

(source)

protocol

(coll-fold coll n combinef reducef)

Examples

jonase/eastwood
(ns testcases.unusednss3
  (:require [clojure.core.protocols :as protocols]
            [clojure.core.reducers  :as reducers]
            [clojure.data           :as data]
            [clojure.java.io        :as io]
            [clojure.reflect        :as reflect]))

(extend-protocol reducers/CollFold
  String
  (coll-fold  [coll n combinef reducef] nil))
dco-dev/interval-tree
(ns com.dean.interval-tree.tree.interval-set
  (:require [clojure.core.reducers       :as r :refer [coll-fold]]
            [clojure.set]
            [com.dean.interval-tree.tree.interval :as interval]
            [com.dean.interval-tree.tree.node     :as node]
            [com.dean.interval-tree.tree.order    :as order]
            [com.dean.interval-tree.tree.protocol :as proto]
            [com.dean.interval-tree.tree.root]
            [com.dean.interval-tree.tree.tree     :as tree])
  (:import  [clojure.lang                RT]
            [com.dean.interval_tree.tree.protocol PExtensibleSet]
            [com.dean.interval_tree.tree.root     INodeCollection
                                         IBalancedCollection
                                         IOrderedCollection
                                         IIntervalCollection]))

  clojure.core.reducers.CollFold
  (coll-fold [this n combinef reducef]
    (with-interval-set this
      (tree/node-chunked-fold n root combinef
        (fn [acc node] (reducef acc (node/-k node)))))))
dco-dev/interval-tree
(ns com.dean.interval-tree.tree.ordered-set
  (:require [clojure.core.reducers       :as r :refer [coll-fold]]
            [clojure.set]
            [com.dean.interval-tree.tree.node     :as node]
            [com.dean.interval-tree.tree.order    :as order]
            [com.dean.interval-tree.tree.protocol :as proto]
            [com.dean.interval-tree.tree.root]
            [com.dean.interval-tree.tree.tree     :as tree])
  (:import  [clojure.lang                RT]
            [com.dean.interval_tree.tree.protocol PExtensibleSet]
            [com.dean.interval_tree.tree.root     INodeCollection
                                         IBalancedCollection
                                         IOrderedCollection]))

  clojure.core.reducers.CollFold
  (coll-fold [this n combinef reducef]
    (with-ordered-set this
      (tree/node-chunked-fold n root combinef
        (fn [acc node] (reducef acc (node/-k node)))))))