Merge pull request #81 from borkdude/master

Added a rule to match if-not/do -> when-not
This commit is contained in:
Jonas Enlund 2014-05-01 16:44:08 +03:00
commit 9ce9f80661
2 changed files with 4 additions and 1 deletions

View file

@ -12,6 +12,7 @@
[(if-let ?binding ?expr nil) (when-let ?binding ?expr)]
[(when ?x (do . ?y)) (when ?x . ?y)]
[(when-not ?x (do . ?y)) (when-not ?x . ?y)]
[(if-not ?x (do . ?y)) (when-not ?x . ?y)]
;; suggest `while` for bindingless loop-recur
[(loop [] (when ?test . ?exprs (recur)))

View file

@ -16,6 +16,8 @@
'(let [a 1] (println a) a) '(let [a 1] (do (println a) a))
'(when test (println a) then) '(when test (do (println a) then))
'(when-not test (println a) then) '(when-not test (do (println a) then))
'(when-not test body) '(if (not test) (do body))
'(when-not test body) '(if-not test (do body))
'(loop [a 4] (println a) (if (zero? a) a (recur (dec a))))
'(loop [a 4] (do (println a) (if (zero? a) a (recur (dec a)))))))