From 11ceb89663f7b0e4144570f8c1ca3643e0f51f37 Mon Sep 17 00:00:00 2001
From: NotTheDr01ds <32344964+NotTheDr01ds@users.noreply.github.com>
Date: Mon, 17 Jun 2024 10:59:00 -0400
Subject: [PATCH] Imperative Language Map Cleanup (#1451)
---
book/nushell_map_imperative.md | 140 ++++++++++++++++-----------------
1 file changed, 70 insertions(+), 70 deletions(-)
diff --git a/book/nushell_map_imperative.md b/book/nushell_map_imperative.md
index 6eba36aa3d9..b93ed99bb69 100644
--- a/book/nushell_map_imperative.md
+++ b/book/nushell_map_imperative.md
@@ -2,74 +2,74 @@
The idea behind this table is to help you understand how Nu built-ins and plugins relate to imperative languages. We've tried to produce a map of programming-relevant Nu commands and what their equivalents are in other languages. Contributions are welcome.
-Note: this table assumes Nu 0.43 or later.
+Note: this table assumes Nu 0.94 or later.
-| Nushell | Python | Kotlin (Java) | C++ | Rust |
-| ------------ | ------------------------------------ | --------------------------------------------------- | ----------------------- | -------------------------------------------------- |
-| append | list.append, set.add | add | push_back, emplace_back | push, push_back |
-| math avg | statistics.mean | | | |
-| calc, = math | math operators | math operators | math operators | math operators |
-| count | len | size, length | length | len |
-| cp | shutil.copy | | | fs::copy |
-| date | datetime.date.today | java.time.LocalDate.now | | |
-| drop | list[:-3] | | | |
-| du | shutil.disk_usage | | | |
-| each | for | for | for | for |
-| exit | exit | System.exit, kotlin.system.exitProcess | exit | exit |
-| http get | urllib.request.urlopen | | | |
-| first | list[:x] | List[0], peek | vector[0], top | Vec[0] |
-| format | format | format | format | format! |
-| from | csv, json, sqlite3 | | | |
-| get | dict[\"key\"] | Map[\"key\"] | map[\"key\"] | HashMap["key"], get, entry |
-| group-by | itertools.groupby | groupBy | | group_by |
-| headers | keys | | | |
-| help | help | | | |
-| insert | dict[\"key\"] = val | | map.insert({ 20, 130 }) | map.insert(\"key\", val) |
-| is-empty | is None, is [] | isEmpty | empty | is_empty |
-| take | list[:x] | | | &Vec[..x] |
-| take until | itertools.takewhile | | | |
-| take while | itertools.takewhile | | | |
-| kill | os.kill | | | |
-| last | list[-x:] | | | &Vec[Vec.len()-1] |
-| lines | split, splitlines | split | views::split | split, split_whitespace, rsplit, lines |
-| ls | os.listdir | | | fs::read_dir |
-| match | match | when | | match |
-| merge | dict.append | | | map.extend |
-| mkdir | os.mkdir | | | fs::create_dir |
-| mv | shutil.move | | | fs::rename |
-| get | list[x] | List[x] | vector[x] | Vec[x] |
-| open | open | | | |
-| transpose | zip(\*matrix) | | | |
-| http post | urllib.request.urlopen | | | |
-| prepend | deque.appendleft | | | |
-| print | print | println | printf | println! |
-| ps | os.listdir('/proc') | | | |
-| pwd | os.getcwd | | | env::current_dir |
-| range | range | .., until, downTo, step | iota | .. |
-| reduce | functools.reduce | reduce | reduce | fold, rfold, scan |
-| reject | del | | | |
-| rename | dict[\"key2\"] = dict.pop(\"key\") | | | map.insert(\"key2\", map.remove(\"key\").unwrap()); |
-| reverse | reversed, list.reverse | reverse, reversed, asReversed | reverse | rev |
-| rm | os.remove | | | |
-| save | io.TextIOWrapper.write | | | |
-| select | {k:dict[k] for k in keys} | | | |
-| shuffle | random.shuffle | | | |
-| size | len | | | len |
-| skip | list[x:] | | | &Vec[x..],skip |
-| skip until | itertools.dropwhile | | | |
-| skip while | itertools.dropwhile | | | skip_while |
-| sort-by | sorted, list.sort | sortedBy, sortedWith, Arrays.sort, Collections.sort | sort | sort |
-| split row | str.split{,lines}, re.split | split | views::split | split |
-| str | str functions | String functions | string functions | &str, String functions |
-| str join | str.join | joinToString | | join |
-| str trim | strip, rstrip, lstrip | trim, trimStart, trimEnd | regex | trim, trim*{start,end}, strip*{suffix,prefix} |
-| sum | sum | sum | reduce | sum |
-| to | import csv, json, sqlite3 | | | |
-| touch | open(path, 'a').close() | | | |
-| uniq | set | Set | set | HashSet |
-| upsert | dict[\"key\"] = val | | | |
-| version | sys.version, sys.version_info | | | |
-| with-env | os.environ | | | |
-| where | filter | filter | filter | filter |
-| which | shutil.which | | | |
-| wrap | { "key" : val } | | | |
+| Nushell | Python | Kotlin (Java) | C++ | Rust |
+| -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | ----------------------------------------------------------- | --------------------------- | ---------------------------------------------------- |
+| [`append`](/commands/docs/append.md) | `list.append`, `set.add` | `add` | `push_back`, `emplace_back` | `push`, `push_back` |
+| [`math avg`](/commands/docs/math_avg.md) | `statistics.mean` | | | |
+| [`math`](/commands/docs/math.md), [Math Operators](nushell_operator_map.md) | Math operators | Math operators | Math operators | Math operators |
+| [`count`](/commands/docs/count.md) | `len` | `size`, `length` | `length` | `len` |
+| [`cp`](/commands/docs/cp.md) | `shutil.copy` | | | `fs::copy` |
+| [`date`](/commands/docs/date.md) | `datetime.date.today` | `java.time.LocalDate.now` | | |
+| [`drop`](/commands/docs/drop.md) | `list[:-3]` | | | |
+| [`du`](/commands/docs/du.md), [`ls --du`](/commands/docs/ls.md) | `shutil.disk_usage` | | | |
+| [`each`](/commands/docs/each.md)
[`for`](/commands/docs/for.md) | `for` | `for` | `for` | `for` |
+| [`exit`](/commands/docs/exit.md) | `exit()` | `System.exit`, `kotlin.system.exitProcess` | `exit` | `exit` |
+| [`http get`](/commands/docs/http_get.md) | `urllib.request.urlopen` | | | |
+| [`first`](/commands/docs/first.md) | `list[:x]` | `List[0]`, `peek` | `vector[0]`, `top` | `Vec[0]` |
+| [`format`](/commands/docs/format.md) | `format` | `format` | `format` | `format!` |
+| [`from`](/commands/docs/from.md) | `csv`, `json`, `sqlite3` | | | |
+| [`get`](/commands/docs/get.md) | `dict[\"key\"]` | `Map[\"key\"]` | `map[\"key\"]` | `HashMap["key"]`, `get`, `entry` |
+| [`group-by`](/commands/docs/group-by.md) | `itertools.groupby` | `groupBy` | | `group_by` |
+| [`headers`](/commands/docs/headers.md) | `keys` | | | |
+| [`help`](/commands/docs/help.md) | `help()` | | | |
+| [`insert`](/commands/docs/insert.md) | `dict[\"key\"] = val` | | `map.insert({ 20, 130 })` | `map.insert(\"key\", val)` |
+| [`is-empty`](/commands/docs/is-empty.md) | `is None`, `is []` | `isEmpty` | `empty` | `is_empty` |
+| [`take`](/commands/docs/take.md) | `list[:x]` | | | `&Vec[..x]` |
+| [`take until`](/commands/docs/take_until.md) | `itertools.takewhile` | | | |
+| [`take while`](/commands/docs/take_while.md) | `itertools.takewhile` | | | |
+| [`kill`](/commands/docs/kill.md) | `os.kill` | | | |
+| [`last`](/commands/docs/last.md) | `list[-x:]` | | | `&Vec[Vec.len()-1]` |
+| [`lines`](/commands/docs/lines.md) | `split`, `splitlines` | `split` | `views::split` | `split`, `split_whitespace`, `rsplit`, `lines` |
+| [`ls`](/commands/docs/ls.md) | `os.listdir` | | | `fs::read_dir` |
+| [`match`](/commands/docs/match.md) | `match` | `when` | | `match` |
+| [`merge`](/commands/docs/merge.md) | `dict.append` | | | `map.extend` |
+| [`mkdir`](/commands/docs/mkdir.md) | `os.mkdir` | | | `fs::create_dir` |
+| [`mv`](/commands/docs/mv.md) | `shutil.move` | | | `fs::rename` |
+| [`get`](/commands/docs/get.md) | `list[x]` | `List[x]` | `vector[x]` | `Vec[x]` |
+| [`open`](/commands/docs/open.md) | `open` | | | |
+| [`transpose`](/commands/docs/transpose.md) | `zip(\*matrix)` | | | |
+| [`http post`](/commands/docs/http_post.md) | `urllib.request.urlopen` | | | |
+| [`prepend`](/commands/docs/prepend.md) | `deque.appendleft` | | | |
+| [`print`](/commands/docs/print.md) | `print` | `println` | `printf` | `println!` |
+| [`ps`](/commands/docs/ps.md) | `os.listdir('/proc')` | | | |
+| [`pwd`](/commands/docs/pwd.md) | `os.getcwd` | | | `env::current_dir` |
+| [`range`](types_of_data.html#ranges) type | `range` | `..`, `until`, `downTo`, `step` | `iota` | `..` |
+| [`reduce`](/commands/docs/reduce.md) | `functools.reduce` | `reduce` | `reduce` | `fold`, `rfold`, `scan` |
+| [`reject`](/commands/docs/reject.md) | `del` | | | |
+| [`rename`](/commands/docs/rename.md) | `dict[\"key2\"] = dict.pop(\"key\")` | | | `map.insert(\"key2\", map.remove(\"key\").unwrap())` |
+| [`reverse`](/commands/docs/reverse.md) | `reversed`, `list.reverse` | `reverse`, `reversed`, `asReversed` | `reverse` | `rev` |
+| [`rm`](/commands/docs/rm.md) | `os.remove` | | | |
+| [`save`](/commands/docs/save.md) | `io.TextIOWrapper.write` | | | |
+| [`select`](/commands/docs/select.md) | `{k:dict[k] for k in keys}` | | | |
+| [`shuffle`](/commands/docs/shuffle.md) | `random.shuffle` | | | |
+| [`str stats`](/commands/docs/str_stats.md)
[`str length`](/commands/docs/str_length.md)
[`length`](/commands/docs/length.md) | `len` | | | `len` |
+| [`skip`](/commands/docs/skip.md) | `list[x:]` | | | `&Vec[x..]`, `skip` |
+| [`skip until`](/commands/docs/skip_until.md) | `itertools.dropwhile` | | | |
+| [`skip while`](/commands/docs/skip_while.md) | `itertools.dropwhile` | | | `skip_while` |
+| [`sort-by`](/commands/docs/sort-by.md) | `sorted`, `list.sort` | `sortedBy`, `sortedWith`, `Arrays.sort`, `Collections.sort` | `sort` | `sort` |
+| [`split row`](/commands/docs/split-row.md) | `str.split{,lines}`, `re.split` | `split` | `views::split` | `split` |
+| [`str`](/commands/docs/str.md) | `str` functions | String functions | String functions | `&str`, String functions |
+| [`str join`](/commands/docs/str_join.md) | `str.join` | `joinToString` | | `join` |
+| [`str trim`](/commands/docs/str_trim.md) | `strip`, `rstrip`, `lstrip` | `trim`, `trimStart`, `trimEnd` | Regex | `trim`, `trim*{start,end}`, `strip*{suffix,prefix}` |
+| [`math sum`](/commands/docs/math_sum.md) | `sum` | `sum` | `reduce` | `sum` |
+| [`to`](/commands/docs/to.md) | `import csv`, `json`, `sqlite3` | | | |
+| [`touch`](/commands/docs/touch.md) | `open(path, 'a').close()` | | | |
+| [`uniq`](/commands/docs/uniq.md) | `set` | Set | `set` | `HashSet` |
+| [`upsert`](/commands/docs/upsert.md) | `dict[\"key\"] = val` | | | |
+| [`version`](/commands/docs/version.md) | `sys.version`, `sys.version_info` | | | |
+| [`with-env`](/commands/docs/with-env.md)
`$env.FOO = "bar"` | `os.environ` | | | |
+| [`where`](/commands/docs/where.md) | `filter` | `filter` | `filter` | `filter` |
+| [`which`](/commands/docs/which.md) | `shutil.which` | | | |
+| [`wrap`](/commands/docs/wrap.md) | `{ "key" : val }` | | | |