Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes #69 - prefer `reduce` over `inject`

  • Loading branch information...
commit d677d44382f0baca0de7cb1037d4a86ad822cf0e 1 parent d31f312
Bozhidar Batsov authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 README.md
View
12 README.md
@@ -526,7 +526,7 @@ syntax.
(i.e. `Array#empty?`).
* The names of potentially "dangerous" methods (i.e. methods that modify `self` or the
arguments, `exit!`, etc.) should end with an exclamation mark.
-* When using `inject` with short blocks, name the arguments `|a, e|`
+* When using `reduce` with short blocks, name the arguments `|a, e|`
(accumulator, element).
* When defining binary operators, name the argument `other`.
@@ -536,9 +536,13 @@ syntax.
end
```
-* Prefer `map` over *collect*, `find` over *detect*, `select` over
- *find_all*, `size` over *length*. This is not a hard requirement; if the
- use of the alias enhances readability, it's ok to use it.
+* Prefer `map` over `collect`, `find` over `detect`, `select` over
+ `find_all`, `reduce` over `inject` and `size` over `length`. This is
+ not a hard requirement; if the use of the alias enhances
+ readability, it's ok to use it. The rhyming methods are inherited from
+ Smalltalk and are not common in other programming languages. The
+ reason the use of `select` is encouraged over `find_all` is that it
+ goes together nicely with `reject` and its name is pretty self-explanatory.
## Comments
Please sign in to comment.
Something went wrong with that request. Please try again.