Skip to content

Commit b064f93

Browse files
committed
Added changelog entry
1 parent c8b0559 commit b064f93

File tree

2 files changed

+2
-87
lines changed

2 files changed

+2
-87
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
### Changed
1515
* Removed implicit support for single-use iterables in sequences, and introduced `iterator-seq` to expliciltly handle them (#1192)
1616
* `basilisp.core/str` now delegates to the builtin Python `str` in all cases except for customizing the string output for builtin Python types (#1237)
17+
* Optimised mainstream seq-consuming functions by coercing their inputs into `seq` upfront (#1234)
1718

1819
### Fixed
1920
* Fix a bug where protocols with methods with leading hyphens in the could not be defined (#1230)

tests/basilisp/test_core_fns.lpy

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,92 +2497,6 @@
24972497
cat
24982498
(iteration range-chunk :somef (partial some #(< % 7)) :kf (comp inc last) :initk 0))))))
24992499

2500-
(def test-generator-vals [0 1 2 "three" nil 5])
2501-
2502-
(defn test-generator []
2503-
(dotimes [i (count test-generator-vals)]
2504-
(yield (nth test-generator-vals i))))
2505-
2506-
(deftest python-iterators-seq-fns-test
2507-
;; The plan here is to consume with each function the test generator
2508-
;; in its entirety, and check for missing values.
2509-
2510-
(testing "every?"
2511-
(let [nums* (atom [])]
2512-
(is (every? #(do (swap! nums* conj %)
2513-
(or (number? %) (string? %) (nil? %)))
2514-
(test-generator)))
2515-
(is (= test-generator-vals @nums*))))
2516-
2517-
(testing "some"
2518-
(let [nums* (atom [])]
2519-
(is (some #(do (swap! nums* conj %)
2520-
(= % 5))
2521-
(test-generator)))
2522-
(is (= test-generator-vals @nums*))))
2523-
2524-
(testing "map"
2525-
(is (= test-generator-vals (map identity (test-generator))))
2526-
(is (= ["00" "11" "22" "threethree" "" "55"] (map str (test-generator) (test-generator)))))
2527-
2528-
(testing "filter"
2529-
(is (= [0 1 2 5] (filter #(and (number? %) (> % -1)) (test-generator)))))
2530-
2531-
(testing "keep"
2532-
(is (= [0 1 2 "three" 5] (keep identity (test-generator)))))
2533-
2534-
(testing "keep-indexed"
2535-
(is (= [[0 0] [1 1] [2 2] [3 "three"] [4 nil] [5 5]] (keep-indexed vector (test-generator)))))
2536-
2537-
(testing "take"
2538-
(is (= test-generator-vals (take 6 (test-generator)))))
2539-
2540-
(testing "take-while"
2541-
(is (= test-generator-vals (take-while #(not= % 7) (test-generator)))))
2542-
2543-
(testing "take-while"
2544-
(is (= test-generator-vals (drop 0 (test-generator)))))
2545-
2546-
(testing "take-while"
2547-
(is (= [1 2 "three" nil 5] (drop-while #(not= % 1) (test-generator)))))
2548-
2549-
(testing "interpose"
2550-
(is (= [0 "-" 1 "-" 2 "-" "three" "-" nil "-" 5] (interpose "-" (test-generator)))))
2551-
2552-
(testing "interleave"
2553-
(is (= [0 0 1 1 2 2 "three" "three" nil nil 5 5] (interleave (test-generator) (test-generator)))))
2554-
2555-
(testing "cycle"
2556-
(is (= [0 1 2 "three" nil 5 0 1 2 "three"] (take 10 (cycle (test-generator))))))
2557-
2558-
(testing "take-nth"
2559-
(is (= [0 2 nil] (take-nth 2 (test-generator)))))
2560-
2561-
(testing "partition"
2562-
(is (= [[0 1] [2 "three"] [nil 5]] (partition 2 (test-generator))))
2563-
(is (= [[0 1] [1 2] [2 "three"] ["three" nil] [nil 5]] (partition 2 1 (test-generator))))
2564-
(is (= [[0 1 2 "three"] [nil 5 :pad :pad]] (partition 4 4 (repeat :pad) (test-generator)))))
2565-
2566-
(testing "partition-all"
2567-
(is (= [[0 1 2 "three"] [nil 5]] (partition-all 4 (test-generator))))
2568-
(is (= [[0 1 2 "three"] [nil 5]] (partition-all 4 4 (test-generator)))))
2569-
2570-
(testing "distinct"
2571-
(is (= test-generator-vals (dedupe (test-generator)))))
2572-
2573-
;; TODO
2574-
;; (testing "flatten"
2575-
;; (is (= nil (flatten [[:a :b :c] (test-generator)]))))
2576-
2577-
2578-
(testing "take-last"
2579-
(is (= [2 "three" nil 5] (take-last 4 (test-generator)))))
2580-
2581-
(testing "sort-by"
2582-
(is (= [5 nil "three" 2 1 0] (reverse (test-generator)))))
2583-
2584-
)
2585-
25862500
;;;;;;;;;;
25872501
;; Taps ;;
25882502
;;;;;;;;;;
@@ -2600,7 +2514,7 @@
26002514
a2-fn #(swap! a2-atom conj [:a2 %])
26012515
b-fn #(swap! b-atom conj %)]
26022516
(add-tap def-fn)
2603-
(remove-tap b-fn) ;; not an error
2517+
(remove-tap b-fn) ;; not an error
26042518
(tap> "this is a test")
26052519

26062520
;; Wait for the tap thread to drain

0 commit comments

Comments
 (0)