Skip to content

Commit

Permalink
Added 'repeatedly' rule as suggested in issue #48
Browse files Browse the repository at this point in the history
  • Loading branch information
jonase committed Aug 25, 2012
1 parent 37b2a6c commit b085c01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/kibit/rules/collections.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@
[(when-not (empty? ?x) . ?y) (when (seq ?x) . ?y)]

;; set
[(into #{} ?coll) (set ?coll)])
[(into #{} ?coll) (set ?coll)]

[(take ?n (repeatedly ?coll)) (repeatedly ?n ?coll)])

3 changes: 2 additions & 1 deletion test/kibit/test/collections.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
'(update-in coll [k] f a b c) '(assoc coll k (f (k coll) a b c))
'(update-in coll [k] f a b c) '(assoc coll k (f (coll k) a b c))
'(update-in coll [k] f a b c) '(assoc coll k (f (get coll k) a b c))
'(assoc-in coll [k1 k2] v) '(update-in coll [k1 k2] assoc v)))
'(assoc-in coll [k1 k2] v) '(update-in coll [k1 k2] assoc v)
'(repeatedly 10 (constantly :foo)) '(take 10 (repeatedly (constantly :foo)))))

0 comments on commit b085c01

Please sign in to comment.