Changed name from 'select-view' to 'subselect'

This commit is contained in:
Alex Engelberg 2016-04-19 12:04:18 -07:00
parent d797e1aec1
commit c7252a2b90
2 changed files with 6 additions and 6 deletions

View file

@ -256,7 +256,7 @@
ancestry)) ancestry))
))) )))
(defn select-view (defn subselect
"Navigates to a sequence that contains the results of (select ...), "Navigates to a sequence that contains the results of (select ...),
but is a view to the original structure that can be transformed. but is a view to the original structure that can be transformed.

View file

@ -510,18 +510,18 @@
)) ))
)) ))
(defspec select-view-nested-vectors (defspec subselect-nested-vectors
(for-all+ (for-all+
[v1 (gen/vector [v1 (gen/vector
(gen/vector gen/int))] (gen/vector gen/int))]
(let [path (s/comp-paths (s/select-view s/ALL s/ALL)) (let [path (s/comp-paths (s/subselect s/ALL s/ALL))
v2 (s/compiled-transform path reverse v1)] v2 (s/compiled-transform path reverse v1)]
(and (and
(= (s/compiled-select path v1) [(flatten v1)]) (= (s/compiled-select path v1) [(flatten v1)])
(= (flatten v1) (reverse (flatten v2))) (= (flatten v1) (reverse (flatten v2)))
(= (map count v1) (map count v2)))))) (= (map count v1) (map count v2))))))
(defspec select-view-param-test (defspec subselect-param-test
(for-all+ (for-all+
[k gen/keyword [k gen/keyword
v (gen/vector v (gen/vector
@ -531,9 +531,9 @@
gen/int gen/int
k)))] k)))]
(and (and
(= (s/compiled-select ((s/select-view s/ALL s/keypath) k) v) (= (s/compiled-select ((s/subselect s/ALL s/keypath) k) v)
[(map k v)]) [(map k v)])
(let [v2 (s/compiled-transform ((s/comp-paths (s/select-view s/ALL s/keypath)) k) (let [v2 (s/compiled-transform ((s/comp-paths (s/subselect s/ALL s/keypath)) k)
reverse reverse
v)] v)]
(and (= (map k v) (reverse (map k v2))) (and (= (map k v) (reverse (map k v2)))