core: move split-at/split-with/ident?/qualified-ident?/simple-ident? to overlay
Second pure-fn batch (jolt-1j0 phase 2). All leaf fns; canonical Clojure defs. split-with now returns seqs for the parts (drop-while is a seq), matching Clojure rather than the prior all-vector result — value-equal either way. conformance 218/218 x3, clojure-test-suite 3927, core-bench 2333ms (~baseline).
This commit is contained in:
parent
16cd617bd6
commit
681b007b7a
2 changed files with 10 additions and 20 deletions
|
|
@ -65,3 +65,13 @@
|
||||||
(defn not-any? [pred coll] (not (some pred coll)))
|
(defn not-any? [pred coll] (not (some pred coll)))
|
||||||
|
|
||||||
(defn not-every? [pred coll] (not (every? pred coll)))
|
(defn not-every? [pred coll] (not (every? pred coll)))
|
||||||
|
|
||||||
|
(defn split-at [n coll] [(take n coll) (drop n coll)])
|
||||||
|
|
||||||
|
(defn split-with [pred coll] [(take-while pred coll) (drop-while pred coll)])
|
||||||
|
|
||||||
|
(defn ident? [x] (or (keyword? x) (symbol? x)))
|
||||||
|
|
||||||
|
(defn qualified-ident? [x] (or (qualified-symbol? x) (qualified-keyword? x)))
|
||||||
|
|
||||||
|
(defn simple-ident? [x] (or (simple-symbol? x) (simple-keyword? x)))
|
||||||
|
|
|
||||||
|
|
@ -1408,11 +1408,6 @@
|
||||||
(and (keyword? x) (not (nil? (string/find "/" (string x))))))
|
(and (keyword? x) (not (nil? (string/find "/" (string x))))))
|
||||||
(defn core-simple-keyword? [x]
|
(defn core-simple-keyword? [x]
|
||||||
(and (keyword? x) (nil? (string/find "/" (string x)))))
|
(and (keyword? x) (nil? (string/find "/" (string x)))))
|
||||||
(defn core-ident? [x] (or (core-keyword? x) (core-symbol? x)))
|
|
||||||
(defn core-qualified-ident? [x]
|
|
||||||
(or (core-qualified-symbol? x) (core-qualified-keyword? x)))
|
|
||||||
(defn core-simple-ident? [x]
|
|
||||||
(or (core-simple-symbol? x) (core-simple-keyword? x)))
|
|
||||||
# Jolt has no inst/uri/uuid host types, so these are always false; inst-ms has
|
# Jolt has no inst/uri/uuid host types, so these are always false; inst-ms has
|
||||||
# nothing valid to read.
|
# nothing valid to read.
|
||||||
(defn core-inst? [x] false)
|
(defn core-inst? [x] false)
|
||||||
|
|
@ -3076,16 +3071,6 @@
|
||||||
{:jolt/type :symbol :ns ns :name nm})
|
{:jolt/type :symbol :ns ns :name nm})
|
||||||
(error "symbol expects 1 or 2 args")))
|
(error "symbol expects 1 or 2 args")))
|
||||||
|
|
||||||
(defn core-split-at [n coll]
|
|
||||||
(let [c (realize-for-iteration coll) m (min n (length c))]
|
|
||||||
[(tuple/slice (tuple ;(array/slice c 0 m))) (tuple/slice (tuple ;(array/slice c m)))]))
|
|
||||||
|
|
||||||
(defn core-split-with [pred coll]
|
|
||||||
(let [c (realize-for-iteration coll)]
|
|
||||||
(var i 0)
|
|
||||||
(while (and (< i (length c)) (truthy? (pred (in c i)))) (++ i))
|
|
||||||
[(tuple/slice (tuple ;(array/slice c 0 i))) (tuple/slice (tuple ;(array/slice c i)))]))
|
|
||||||
|
|
||||||
(defn- td-take-nth [n]
|
(defn- td-take-nth [n]
|
||||||
(fn [rf]
|
(fn [rf]
|
||||||
(var i 0)
|
(var i 0)
|
||||||
|
|
@ -3785,8 +3770,6 @@
|
||||||
"sorted?" core-sorted-map?
|
"sorted?" core-sorted-map?
|
||||||
"reduced" core-reduced
|
"reduced" core-reduced
|
||||||
"reduced?" core-reduced?
|
"reduced?" core-reduced?
|
||||||
"split-at" core-split-at
|
|
||||||
"split-with" core-split-with
|
|
||||||
"take-nth" core-take-nth
|
"take-nth" core-take-nth
|
||||||
"nthrest" core-nthrest
|
"nthrest" core-nthrest
|
||||||
"nthnext" core-nthnext
|
"nthnext" core-nthnext
|
||||||
|
|
@ -4080,9 +4063,6 @@
|
||||||
"simple-symbol?" core-simple-symbol?
|
"simple-symbol?" core-simple-symbol?
|
||||||
"qualified-keyword?" core-qualified-keyword?
|
"qualified-keyword?" core-qualified-keyword?
|
||||||
"simple-keyword?" core-simple-keyword?
|
"simple-keyword?" core-simple-keyword?
|
||||||
"ident?" core-ident?
|
|
||||||
"qualified-ident?" core-qualified-ident?
|
|
||||||
"simple-ident?" core-simple-ident?
|
|
||||||
"inst?" core-inst?
|
"inst?" core-inst?
|
||||||
"inst-ms" core-inst-ms
|
"inst-ms" core-inst-ms
|
||||||
"uri?" core-uri?
|
"uri?" core-uri?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue