Skip to content

Commit 069d9d1

Browse files
author
Bozhidar Batsov
committed
Prefer vec over into when converting sequences to vectors
1 parent 0d7e8ea commit 069d9d1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,18 @@ pairwise constructs as found in e.g. `let` and `cond`.
420420
(recur (rest s))))
421421
```
422422

423+
* <a name="to-vector"></a>
424+
Prefer `vec` over `into` when you need to convert a sequence into a vector.
425+
<sup>[[link](#to-vector)]</sup>
426+
427+
```Clojure
428+
;; good
429+
(vec some-seq)
430+
431+
;; bad
432+
(into [] some-seq)
433+
```
434+
423435
* <a name="when-instead-of-single-branch-if"></a>
424436
Use `when` instead of `(if ... (do ...)`.
425437
<sup>[[link](#when-instead-of-single-branch-if)]</sup>

0 commit comments

Comments
 (0)