Public Vars

Back

chunk-buffer (clj)

(source)

function

(chunk-buffer capacity)

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))))


;; START CHUNK HACKS
;; These are hacks to get around the expansion of doseq>
;; Basically, inference isn't good enough to narrow a (t/Seqable x) to 
;; an (IChunk x), because chunked-seq? needs to be (t/Pred (IChunk t/Any)).
#?@(:cljs [] :default [
cc/chunked-seq? [t/Any :-> t/Any]
cc/chunk-first 
     (t/All [x]
          ;should be IChunkedSeq :-> IChunk
          [(t/Seqable x) :-> (clojure.lang.IChunk x)])
cc/chunk-rest
     (t/All [x]
          ;should be IChunkRest :-> t/Seq
          [(t/Seqable x) :-> (t/ASeq x)])
cc/chunk-buffer
     (t/All [x]
          [(t/U Integer Long) :-> (clojure.lang.ChunkBuffer x)])
cc/chunk
     (t/All [x]
          [(clojure.lang.ChunkBuffer x) :-> (clojure.lang.IChunk x)])
cc/chunk-cons
     (t/All [x]
          [(clojure.lang.IChunk x) (t/Seqable x) :-> (t/ASeq x)])
cc/chunk-append
     (t/All [x]
          [(clojure.lang.ChunkBuffer x) x :-> t/Any])
;;END CHUNK HACKS
])