another empty? recommendation #45

Merged
merged 1 commit into from Jul 10, 2012
View
1 src/kibit/rules/collections.clj
@@ -8,6 +8,7 @@
;; empty?
[(not (empty? ?x)) (seq ?x)]
+ [(when-not (empty? ?x) . ?y) (when (seq ?x) . ?y)]
;; set
[(into #{} ?coll) (set ?coll)])
View
2 test/kibit/test/collections.clj
@@ -6,6 +6,8 @@
(are [expected-alt-form test-form]
(= expected-alt-form (:alt (kibit/check-expr test-form)))
'(seq a) '(not (empty? a))
+ '(when (seq a) b) '(when-not (empty? a) b)
+ '(when (seq a) b) '(when (not (empty? a)) b)
'(vector a) '(conj [] a)
'(vector a b) '(conj [] a b)
'(vec coll) '(into [] coll)