File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -2218,22 +2218,15 @@ defmodule Enum do
2218
2218
function.
2219
2219
2220
2220
This function maps each element of the enumerable using the provided `mapper`
2221
- function. The enumerable is then sorted by the mapped elements
2222
- using the `sorter` function, which defaults to `Kernel.<=/2`
2221
+ function. The enumerable is then sorted by the mapped elements
2222
+ using the `sorter` function, which defaults to `Kernel.<=/2`.
2223
2223
2224
2224
`sort_by/3` differs from `sort/2` in that it only calculates the
2225
2225
comparison value for each element in the enumerable once instead of
2226
2226
once for each element in each comparison.
2227
- If the same function is being called on both element , it's also more
2227
+ If the same function is being called on both elements , it's also more
2228
2228
compact to use `sort_by/3`.
2229
2229
2230
- This technique is also known as a
2231
- _[Schwartzian Transform](https://en.wikipedia.org/wiki/Schwartzian_transform)_,
2232
- or the _Lisp decorate-sort-undecorate idiom_ as the `mapper`
2233
- is decorating the original `enumerable`; then `sorter` is sorting the
2234
- decorations; and finally the enumerable is being undecorated so only
2235
- the original elements remain, but now in sorted order.
2236
-
2237
2230
## Examples
2238
2231
2239
2232
Using the default `sorter` of `<=/2`:
You can’t perform that action at this time.
0 commit comments