IntegerRangeChunk

typesince v1.10.844Edit
satisfies IChunk ICounted IIndexed ISeq

(IntegerRangeChunk. start step count)

Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(deftype IntegerRangeChunk [start step count]
  ICounted
  (-count [coll] count)

  ISeq
  (-first [coll] start)

  IIndexed
  (-nth [coll i]
    (+ start (* i step)))
  (-nth [coll i not-found]
    (if (and (>= i 0) (< i count))
      (+ start (* i step))
      not-found))

  IChunk
  (-drop-first [coll]
    (if (<= count 1)
      (throw (js/Error. "-drop-first of empty chunk"))
      (IntegerRangeChunk. (+ start step) step (dec count)))))