Merge pull request #42 from duelinmarkers/issue-39

Fix 'remove suggestion for 'filter with anonymous fn
This commit is contained in:
Jonas Enlund 2012-06-26 08:21:01 -07:00
commit 66b318bd42
3 changed files with 5 additions and 9 deletions

View file

@ -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)]
@ -44,9 +45,6 @@
(not= \. (first (str %)))
(not-any? #{\/} (str %)))))))
#(logic/== % fun)])
;; do
[(do ?x) ?x]
;; Java stuff
[(.toString ?x) (str ?x)]
@ -99,11 +97,9 @@
(logic/project [form]
(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

View file

@ -4,4 +4,3 @@
(defrules rules
;; reduce on var-arg functions
[(reduce + ?coll) (apply + ?coll)])

View file

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