added filterv rule
This commit is contained in:
parent
a07b90a8b1
commit
17f6f0e9a5
3 changed files with 3 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
(defproject yogsototh/kibit "0.1.5"
|
(defproject yogsototh/kibit "0.1.6-SNAPSHOT"
|
||||||
:description "There's a function for that!"
|
:description "There's a function for that!"
|
||||||
:url "https://github.com/yogsototh/kibit"
|
:url "https://github.com/yogsototh/kibit"
|
||||||
:license {:name "Eclipse Public License - v 1.0"
|
:license {:name "Eclipse Public License - v 1.0"
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
[(apply concat (map ?x . ?y)) (mapcat ?x . ?y)]
|
[(apply concat (map ?x . ?y)) (mapcat ?x . ?y)]
|
||||||
|
|
||||||
;; filter
|
;; filter
|
||||||
|
[(vec (filter ?pred ?coll)) (filterv ?pred ?coll)]
|
||||||
[(filter (complement ?pred) ?coll) (remove ?pred ?coll)]
|
[(filter (complement ?pred) ?coll) (remove ?pred ?coll)]
|
||||||
[(filter seq ?coll) (remove empty? ?coll)]
|
[(filter seq ?coll) (remove empty? ?coll)]
|
||||||
[(filter (fn* [?x] (not (?pred ?x))) ?coll) (remove ?pred ?coll)]
|
[(filter (fn* [?x] (not (?pred ?x))) ?coll) (remove ?pred ?coll)]
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
'(remove pred coll) '(filter (complement pred) coll)
|
'(remove pred coll) '(filter (complement pred) coll)
|
||||||
'(remove pred coll) '(filter #(not (pred %)) coll)
|
'(remove pred coll) '(filter #(not (pred %)) coll)
|
||||||
'(remove pred coll) '(filter (fn [x] (not (pred x))) coll)
|
'(remove pred coll) '(filter (fn [x] (not (pred x))) coll)
|
||||||
|
'(filterv pred coll) '(vec (filter pred coll))
|
||||||
'(ffirst coll) '(first (first coll))
|
'(ffirst coll) '(first (first coll))
|
||||||
'(fnext coll) '(first (next coll))
|
'(fnext coll) '(first (next coll))
|
||||||
'(nnext coll) '(next (next coll))
|
'(nnext coll) '(next (next coll))
|
||||||
|
|
Loading…
Reference in a new issue