par-each for filters> par-each {flags} (closure)
--threads, -t {int}: the number of threads to use--keep-order, -k: keep sequence of output same as the order of inputclosure: the closure to run| input | output | 
|---|---|
| list<any> | list<any> | 
| range | list<any> | 
| table | list<any> | 
Multiplies each number. Note that the list will become arbitrarily disordered.
> [123] |par-each {|e| $e*2 }
Multiplies each number, keeping an original order
> [123] |par-each--keep-order {|e| $e*2 }
╭───┬───╮
│0│2│
│1│4│
│2│6│
╰───┴───╯
Enumerate and sort-by can be used to reconstruct the original order
>1..3|enumerate|par-each {|p| updateitem ($p.item*2)} |sort-byitem|getitem
╭───┬───╮
│0│2│
│1│4│
│2│6│
╰───┴───╯
Output can still be sorted afterward
> [foobarbaz] |par-each {|e| $e+'!' } |sort
╭───┬──────╮
│0│bar!│
│1│baz!│
│2│foo!│
╰───┴──────╯
Iterate over each element, producing a list showing indexes of any 2s
> [123] |enumerate|par-each { |e| if$e.item==2 { $"found 2 at ($e.index)!"} }
╭───┬───────────────╮
│0│found2at1!│
╰───┴───────────────╯
    Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
    https://www.nushell.sh/commands/docs/par-each.html