added filterv rule

This commit is contained in:
Yann Esposito (Yogsototh) 2016-06-14 09:03:04 +02:00
parent a07b90a8b1
commit 17f6f0e9a5
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
3 changed files with 3 additions and 1 deletions

View file

@ -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"

View file

@ -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)]

View file

@ -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))