Merge pull request #42 from duelinmarkers/issue-39
Fix 'remove suggestion for 'filter with anonymous fn
This commit is contained in:
commit
66b318bd42
3 changed files with 5 additions and 9 deletions
|
@ -23,7 +23,8 @@
|
|||
|
||||
;; filter
|
||||
[(filter (complement ?pred) ?coll) (remove ?pred ?coll)]
|
||||
[(filter #(not (?pred ?x)) ?coll) (remove ?pred ?coll)]
|
||||
[(filter (fn* [?x] (not (?pred ?x))) ?coll) (remove ?pred ?coll)]
|
||||
[(filter (fn [?x] (not (?pred ?x))) ?coll) (remove ?pred ?coll)]
|
||||
|
||||
;; first/next shorthands
|
||||
[(first (first ?coll)) (ffirst ?coll)]
|
||||
|
@ -45,9 +46,6 @@
|
|||
(not-any? #{\/} (str %)))))))
|
||||
#(logic/== % fun)])
|
||||
|
||||
;; do
|
||||
[(do ?x) ?x]
|
||||
|
||||
;; Java stuff
|
||||
[(.toString ?x) (str ?x)]
|
||||
|
||||
|
@ -100,10 +98,8 @@
|
|||
(logic/== sbst (concat form (list arg)))))]))])
|
||||
|
||||
|
||||
|
||||
;; Other
|
||||
[(not (some ?pred ?coll)) (not-any? ?pred ?coll)]
|
||||
[(not (= . ?args)) (not= . ?args)])
|
||||
[(not (some ?pred ?coll)) (not-any? ?pred ?coll)])
|
||||
|
||||
|
||||
(comment
|
||||
|
|
|
@ -4,4 +4,3 @@
|
|||
(defrules rules
|
||||
;; reduce on var-arg functions
|
||||
[(reduce + ?coll) (apply + ?coll)])
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
'(mapcat x y) '(apply concat (apply map x y))
|
||||
'(mapcat x y) '(apply concat (map x y))
|
||||
'(remove pred coll) '(filter (complement pred) coll)
|
||||
;'(remove pred coll) '(filter #(not (pred %)) coll) -- Expanded form of anonymous fn literal not matching.
|
||||
'(remove pred coll) '(filter #(not (pred %)) coll)
|
||||
'(remove pred coll) '(filter (fn [x] (not (pred x))) coll)
|
||||
'(ffirst coll) '(first (first coll))
|
||||
'(fnext coll) '(first (next coll))
|
||||
'(nnext coll) '(next (next coll))
|
||||
|
|
Loading…
Reference in a new issue