Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
* Fix a bug where `#` characters were not legal in keywords and symbols (#1149)
* Fix a bug where seqs were not considered valid input for matching clauses of the `case` macro (#1148)

## [v0.3.3]
### Added
Expand Down
2 changes: 1 addition & 1 deletion src/basilisp/core.lpy
Original file line number Diff line number Diff line change
Expand Up @@ -3537,7 +3537,7 @@
(mapcat (fn [pair]
(let [binding (first pair)
expr `(fn [] ~(second pair))]
(if (list? binding)
(if (seq? binding)
(map #(vector (list 'quote %) expr) binding)
[[(list 'quote binding) expr]])))
(partition 2
Expand Down
6 changes: 6 additions & 0 deletions tests/basilisp/test_core_macros.lpy
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@
(let [l #py [1 2 3]]
(is (= 6 (areduce l idx ret 0 (+ ret (aget l idx)))))))

(defmacro case-with-seq
[]
`(case :val
~(seq [:val]) :found))

(deftest case-test
(is (= "yes" (case :a :b "nope" :c "mega nope" :a "yes" "nerp")))
(is (= "nope" (case :b :b "nope" :c "mega nope" :a "yes" "nerp")))
Expand All @@ -328,6 +333,7 @@
(is (= "also no" (case 'd :a "no" (b c d) "also no" "duh")))
(is (= "duh" (case 'e :a "no" (b c d) "also no" "duh")))
(is (= 0 (case 1 0)))
(is (= :found (case-with-seq)))
(let [out* (atom [])]
(is (= 2 (case :2
:1 (do (swap! out* conj 1) 1)
Expand Down