Skip to content

Commit df9f0a3

Browse files
committed
Remove duplicate record sorting section
1 parent 88a76cb commit df9f0a3

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

book/sorting.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -165,30 +165,6 @@ Furthermore, we can use more complex cell paths to sort nested data:
165165
╰───┴───────────┴────────────────────────────╯
166166
```
167167

168-
### Sorting records
169-
170-
Records can be sorted in order of their keys using `sort`:
171-
172-
```nu
173-
> {foo: 123, bar: 456, baz: 89} | sort
174-
╭─────┬─────╮
175-
│ bar │ 456 │
176-
│ baz │ 89 │
177-
│ foo │ 123 │
178-
╰─────┴─────╯
179-
```
180-
181-
To instead sort in order of a record's values, use `sort -v`:
182-
183-
```nu
184-
> {foo: 123, bar: 456, baz: 89} | sort -v
185-
╭─────┬─────╮
186-
│ baz │ 89 │
187-
│ foo │ 123 │
188-
│ bar │ 456 │
189-
╰─────┴─────╯
190-
```
191-
192168
### Sort by key closure
193169

194170
Sometimes, it's useful to sort data in a more complicated manner than "increasing" or "decreasing". Instead of using `sort-by` with a cell path, you can supply a [closure](types_of_data.html#closures), which will transform each value into a [sorting key](https://en.wikipedia.org/wiki/Collation#Sort_keys) _without changing the underlying data_. Here's an example of a key closure, where we want to sort a list of assignments by their average grade:

0 commit comments

Comments
 (0)