Public Vars

Back

some->> (clj)

(source)

macro

(some->> expr & forms)
When expr is not nil, threads it into the first form (via ->>), and when that result is not nil, through the next etc

Examples

dco-dev/interval-tree
(ns com.dean.interval-tree.tree.interval-map
  (:require [clojure.core.reducers       :as r :refer [coll-fold]]
            [com.dean.interval-tree.tree.interval :as interval]
            [com.dean.interval-tree.tree.node     :as node]
            [com.dean.interval-tree.tree.root]
            [com.dean.interval-tree.tree.order    :as order]
            [com.dean.interval-tree.tree.tree     :as tree])
  (:import  [clojure.lang                RT]
            [com.dean.interval_tree.tree.root     INodeCollection
                                         IBalancedCollection
                                         IOrderedCollection
                                         IIntervalCollection]))

  clojure.lang.Associative
  (containsKey [this k]
    (with-interval-map this
      (not (empty? (tree/node-find-intervals root k)))))
  (entryAt [this k]
    (with-interval-map this
      (some->> k (tree/node-find-intervals root) (map node/-kv))))
  (assoc [this k v]
    (with-interval-map this
      (IntervalMap. (tree/node-add root (interval/ordered-pair k) v) cmp alloc stitch _meta)))
  (empty [this]
    (IntervalMap. (node/leaf) cmp alloc stitch {}))