Skip to content

Commit 34ddcba

Browse files
author
Bozhidar Batsov
committed
Add a rule about comparisions
1 parent cc0f617 commit 34ddcba

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,17 @@ pairwise constructs as found in e.g. `let` and `cond`.
433433
(not (= foo bar))
434434
```
435435

436+
* When doing comparisons keep in mind that Clojure's functions `<`,
437+
`>`, etc accept variable number of arguments.
438+
439+
```Clojure
440+
;; good
441+
(< 5 x 10)
442+
443+
;; bad
444+
(and (> x 5) (< x 10))
445+
```
446+
436447
* Prefer `%` over `%1` in function literals with only one parameter.
437448

438449
```Clojure
@@ -494,7 +505,7 @@ pairwise constructs as found in e.g. `let` and `cond`.
494505

495506
```Clojure
496507
;; Assuming `(:require [clojure.string :as str])`...
497-
508+
498509
;; good
499510
(map #(str/capitalize (str/trim %)) ["top " " test "])
500511

0 commit comments

Comments
 (0)