29172917 (rf result input))))))))
29182918 ([n coll]
29192919 (if (instance? github.com$glojurelang$glojure$pkg$lang.IDrop coll)
2920- (or (.drop ^github.com$glojurelang$glojure$pkg$lang.IDrop coll n) ())
2920+ (or
2921+ (if (pos? n)
2922+ (.drop ^github.com$glojurelang$glojure$pkg$lang.IDrop coll (if (int? n) n (Math/ceil n)))
2923+ (seq coll))
2924+ ())
29212925 (let [step (fn [n coll]
29222926 (let [s (seq coll)]
29232927 (if (and (pos? n) s)
30053009 [n x] (take n (repeat x)))
30063010
30073011(defn iterate
3008- "Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
3012+ "Returns a lazy (infinite!) sequence of x, (f x), (f (f x)) etc.
3013+ f must be free of side-effects"
30093014 {:added "1.0"
30103015 :static true}
30113016 [f x] (glojure.lang.Iterate/create f x) )
30203025 ([]
30213026 (iterate inc' 0))
30223027 ([end]
3023- (if (instance? go/int64 end)
3028+ (if (int? end)
30243029 (github.com$glojurelang$glojure$pkg$lang.NewLongRange 0 end 1)
30253030 (github.com$glojurelang$glojure$pkg$lang.NewRange 0 end 1)))
30263031 ([start end]
3027- (if (and (instance? go/int64 start) (instance? go/int64 end))
3032+ (if (and (int? start) (int? end))
30283033 (github.com$glojurelang$glojure$pkg$lang.NewLongRange start end 1)
30293034 (github.com$glojurelang$glojure$pkg$lang.NewRange start end 1)))
30303035 ([start end step]
3031- (if (and (instance? go/int64 start) (instance? go/int64 end) (instance? go/int64 step))
3036+ (if (and (int? start) (int? end) (int? step))
30323037 (github.com$glojurelang$glojure$pkg$lang.NewLongRange start end step)
30333038 (github.com$glojurelang$glojure$pkg$lang.NewRange start end step))))
30343039
31453150 :static true}
31463151 [coll n]
31473152 (if (instance? github.com$glojurelang$glojure$pkg$lang.IDrop coll)
3148- (.drop ^github.com$glojurelang$glojure$pkg$lang.IDrop coll n)
3153+ (if (pos? n)
3154+ (.drop ^github.com$glojurelang$glojure$pkg$lang.IDrop coll (if (int? n) n (Math/ceil n)))
3155+ (seq coll))
31493156 (loop [n n xs (seq coll)]
31503157 (if (and xs (pos? n))
31513158 (recur (dec n) (next xs))
31563163 {:added "1.3"
31573164 :static true}
31583165 [coll n]
3159- (if (instance? github.com$glojurelang$glojure$pkg$lang.IDrop coll)
3160- (or (.drop ^github.com$glojurelang$glojure$pkg$lang.IDrop coll n) ())
3161- (loop [n n xs coll]
3162- (if-let [xs (and (pos? n) (seq xs))]
3163- (recur (dec n) (rest xs))
3164- xs))))
3166+ (if (pos? n)
3167+ (or
3168+ (if (instance? github.com$glojurelang$glojure$pkg$lang.IDrop coll)
3169+ (.drop ^github.com$glojurelang$glojure$pkg$lang.IDrop coll (if (int? n) n (Math/ceil n)))
3170+ (loop [n n xs coll]
3171+ (if-let [xs (and (pos? n) (seq xs))]
3172+ (recur (dec n) (rest xs))
3173+ (seq xs))))
3174+ ())
3175+ coll))
31653176
31663177(defn partition
31673178 "Returns a lazy sequence of lists of n items each, at offsets step
33223333
33233334;;;;;;;;;;;;;;;;;;;;; editable collections ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33243335(defn transient
3325- "Returns a new, transient version of the collection, in constant time."
3336+ "Returns a new, transient version of the collection, in constant time.
3337+
3338+ Transients support a parallel set of 'changing' operations, with similar names
3339+ followed by ! - assoc!, conj! etc. These do the same things as their persistent
3340+ counterparts except the return values are themselves transient.
3341+
3342+ Note in particular that transients are not designed to be bashed in-place. You
3343+ must capture and use the return value in the next call. In this way, they support
3344+ the same code structure as the functional persistent code they replace."
33263345 {:added "1.1"
33273346 :static true}
33283347 [^github.com$glojurelang$glojure$pkg$lang.IEditableCollection coll]
38273846 (try
38283847 (with-open ~(subvec bindings 2) ~@body)
38293848 (finally
3830- (. ~(bindings 0) close))))
3849+ (. ~(bindings 0) ~' close))))
38313850 :else (throw (github.com$glojurelang$glojure$pkg$lang.NewIllegalArgumentError
38323851 "with-open only allows Symbols in bindings"))))
38333852
48164835 (.getCause ^github.com$glojurelang$glojure$pkg$lang.Throwable ex)))
48174836
48184837(defmacro assert
4819- "Evaluates expr and throws an exception if it does not evaluate to
4820- logical true."
4838+ "Evaluates expression x and throws an AssertionError with optional
4839+ message if x does not evaluate to logical true.
4840+
4841+ Assertion checks are omitted from compiled code if '*assert*' is
4842+ false."
48214843 {:added "1.0"}
48224844 ([x]
48234845 (when *assert*
@@ -6306,6 +6328,11 @@ fails, attempts to require sym's namespace and retries."
63066328 :added "1.0"}
63076329 *e)
63086330
6331+ (def ^:dynamic
6332+ ^{:doc "Bound to true in a repl thread"
6333+ :added "1.12"}
6334+ *repl* false)
6335+
63096336(defn trampoline
63106337 "trampoline can be used to convert algorithms requiring mutual
63116338 recursion without stack consumption. Calls f with supplied args, if
@@ -6540,6 +6567,11 @@ fails, attempts to require sym's namespace and retries."
65406567 "
65416568 {:added "1.0"})
65426569
6570+ (add-doc-and-meta *assert*
6571+ "When set to logical false, 'assert' will omit assertion checks in
6572+ compiled code. Defaults to true."
6573+ {:added "1.0"})
6574+
65436575(defn future?
65446576 "Returns true if x is a future"
65456577 {:added "1.1"
@@ -6783,8 +6815,6 @@ fails, attempts to require sym's namespace and retries."
67836815 `(let [~ge ~e] (case* ~ge ~shift ~mask ~default ~imap ~switch-type :hash-identity ~skip-check))))))))
67846816
67856817
6786- ;; redefine reduce with internal-reduce
6787-
67886818;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; helper files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
67896819(alter-meta! (find-ns 'glojure.core) assoc :doc "Fundamental library of the Clojure language")
67906820(do)
@@ -6794,6 +6824,45 @@ fails, attempts to require sym's namespace and retries."
67946824(load "protocols")
67956825(do)
67966826
6827+ (defn stream-reduce!
6828+ "Works like reduce but takes a java.util.stream.BaseStream as its source.
6829+ Honors 'reduced', is a terminal operation on the stream"
6830+ {:added "1.12"}
6831+ ([f ^java.util.stream.BaseStream s]
6832+ (glojure.core.protocols/iterator-reduce! (.iterator s) f))
6833+ ([f init ^java.util.stream.BaseStream s]
6834+ (glojure.core.protocols/iterator-reduce! (.iterator s) f init)))
6835+
6836+ (defn stream-seq!
6837+ "Takes a java.util.stream.BaseStream instance s and returns a seq of its
6838+ contents. This is a terminal operation on the stream."
6839+ {:added "1.12"}
6840+ [^java.util.stream.BaseStream stream]
6841+ (iterator-seq (.iterator stream)))
6842+
6843+ (defn stream-transduce!
6844+ "Works like transduce but takes a java.util.stream.BaseStream as its source.
6845+ This is a terminal operation on the stream."
6846+ {:added "1.12"}
6847+ ([xform f ^java.util.stream.BaseStream stream] (stream-transduce! xform f (f) stream))
6848+ ([xform f init ^java.util.stream.BaseStream stream]
6849+ (let [f (xform f)
6850+ ret (stream-reduce! f init stream)]
6851+ (f ret))))
6852+
6853+ (defn stream-into!
6854+ "Returns a new coll consisting of coll with all of the items of the
6855+ stream conjoined. This is a terminal operation on the stream."
6856+ {:added "1.12"}
6857+ ([to ^java.util.stream.BaseStream stream]
6858+ (if (instance? github.com$glojurelang$glojure$pkg$lang.IEditableCollection to)
6859+ (with-meta (persistent! (stream-reduce! conj! (transient to) stream)) (meta to))
6860+ (stream-reduce! conj to stream)))
6861+ ([to xform ^java.util.stream.BaseStream stream]
6862+ (if (instance? github.com$glojurelang$glojure$pkg$lang.IEditableCollection to)
6863+ (with-meta (persistent! (stream-transduce! xform conj! (transient to) stream)) (meta to))
6864+ (stream-transduce! xform conj to stream))))
6865+
67976866(do)
67986867
67996868(do)
@@ -6830,6 +6899,7 @@ fails, attempts to require sym's namespace and retries."
68306899 :added "1.11"}
68316900 ^java.util.UUID [] (java.util.UUID/randomUUID))
68326901
6902+ ;; redefine reduce with internal-reduce
68336903(defn reduce
68346904 "f should be a function of 2 arguments. If val is not supplied,
68356905 returns the result of applying f to the first 2 items in coll, then
@@ -6893,8 +6963,9 @@ fails, attempts to require sym's namespace and retries."
68936963 (f ret))))
68946964
68956965(defn into
6896- "Returns a new coll consisting of to-coll with all of the items of
6897- from-coll conjoined. A transducer may be supplied."
6966+ "Returns a new coll consisting of to with all of the items of
6967+ from conjoined. A transducer may be supplied.
6968+ (into x) returns x. (into) returns []."
68986969 {:added "1.0"
68996970 :static true}
69006971 ([] [])
@@ -7252,7 +7323,7 @@ fails, attempts to require sym's namespace and retries."
72527323 (let [p (into [] (take n) s)]
72537324 (if (= n (count p))
72547325 (cons p (partitionv n step pad (nthrest s step)))
7255- (into [] (take n) (concat p pad))))))))
7326+ (list ( into [] (take n) (concat p pad) ))))))))
72567327
72577328(defn partitionv-all
72587329 "Returns a lazy sequence of vector partitions, but may include
0 commit comments