diff --git a/book/nushell_map_functional.md b/book/nushell_map_functional.md index d66018e3a76..047ae55be61 100644 --- a/book/nushell_map_functional.md +++ b/book/nushell_map_functional.md @@ -4,44 +4,45 @@ The idea behind this table is to help you understand how Nu builtins and plugins Note: this table assumes Nu 0.43 or later. -| Nushell | Clojure | Tablecloth (Ocaml / Elm) | Haskell | -| ------------ | ---------------------------- | ------------------------------- | ------------------------ | -| append | conj, into, concat | append, (++), concat, concatMap | (++) | -| into binary | Integer/toHexString | | showHex | -| count | count | length, size | length, size | -| date | java.time.LocalDate/now | | | -| each | map, mapv, iterate | map, forEach | map, mapM | -| exit | System/exit | | | -| first | first | head | head | -| format | format | | Text.Printf.printf | -| group-by | group-by | | group, groupBy | -| help | doc | | | -| is-empty | empty? | isEmpty | | -| last | last, peek, take-last | last | last | -| lines | | | lines, words, split-with | -| match | | match (Ocaml), case (Elm) | case | -| nth | nth | Array.get | lookup | -| open | with-open | | | -| transpose | (apply mapv vector matrix) | | transpose | -| prepend | cons | cons, :: | :: | -| print | println | | putStrLn, print | -| range, 1..10 | range | range | 1..10, 'a'..'f' | -| reduce | reduce, reduce-kv | foldr | foldr | -| reverse | reverse, rseq | reverse, reverseInPlace | reverse | -| select | select-keys | | | -| shuffle | shuffle | | | -| size | count | | size, length | -| skip | rest | tail | tail | -| skip until | drop-while | | | -| skip while | drop-while | dropWhile | dropWhile, dropWhileEnd | -| sort-by | sort, sort-by, sorted-set-by | sort, sortBy, sortWith | sort, sortBy | -| split row | split, split-{at,with,lines} | split, words, lines | split, words, lines | -| str | clojure.string functions | String functions | | -| str join | join | concat | intercalate | -| str trim | trim, triml, trimr | trim, trimLeft, trimRight | strip | -| sum | apply + | sum | sum | -| take | take, drop-last, pop | take, init | take, init | -| take until | take-while | takeWhile | takeWhile | -| take while | take-while | takeWhile | takeWhile | -| uniq | set | Set.empty | Data.Set | -| where | filter, filterv, select | filter, filterMap | filter | +| Nushell | Clojure | Tablecloth (Ocaml / Elm) | Haskell | Nix | +| ------------ | ---------------------------- | ------------------------------- | ------------------------ | ------------------------------ | +| append | conj, into, concat | append, (++), concat, concatMap | (++) | `builtins.concatLists` | +| into binary | Integer/toHexString | | showHex | `toString (toHex value)` | +| count | count | length, size | length, size | `builtins.length` | +| date | java.time.LocalDate/now | | | `builtins.time` | +| each | map, mapv, iterate | map, forEach | map, mapM | `map` | +| exit | System/exit | | | `throw` | +| first | first | head | head | `builtins.head` | +| format | format | | Text.Printf.printf | `builtins.toString` | +| group-by | group-by | | group, groupBy | Custom function with `map` | +| help | doc | | | N/A (Check Nix docs) | +| is-empty | empty? | isEmpty | | `length == 0` | +| last | last, peek, take-last | last | last | `builtins.last` | +| lines | | | lines, words, split-with | `splitString ""` | +| match | | match (Ocaml), case (Elm) | case | N/A (Custom logic) | +| nth | nth | Array.get | lookup | `list[]` | +| open | with-open | | | N/A (Declarative paradigm) | +| transpose | (apply mapv vector matrix) | | transpose | Custom function | +| prepend | cons | cons, :: | :: | `[value] ++ list` | +| print | println | | putStrLn, print | `builtins.trace` | +| range, 1..10 | range | range | 1..10, 'a'..'f' | `builtins.genList` | +| reduce | reduce, reduce-kv | foldr | foldr | Custom function with `fold` | +| reverse | reverse, rseq | reverse, reverseInPlace | reverse | `builtins.reverse` | +| select | select-keys | | | Custom function with `attr` | +| shuffle | shuffle | | | N/A (Write custom logic) | +| size | count | | size, length | `builtins.length` | +| skip | rest | tail | tail | `builtins.tail` | +| skip until | drop-while | | | Custom function with `filter` | +| skip while | drop-while | dropWhile | dropWhile, dropWhileEnd | Custom function with `filter` | +| sort-by | sort, sort-by, sorted-set-by | sort, sortBy, sortWith | sort, sortBy | Custom sort logic | +| split row | split, split-{at,with,lines} | split, words, lines | split, words, lines | `lib.splitString` | +| str | clojure.string functions | String functions | | `builtins.toString` | +| str join | join | concat | intercalate | `builtins.concatStringsSep` | +| str trim | trim, triml, trimr | trim, trimLeft, trimRight | strip | Custom function | +| sum | apply + | sum | sum | Custom fold logic | +| take | take, drop-last, pop | take, init | take, init | `builtins.slice` | +| take until | take-while | takeWhile | takeWhile | Custom function | +| take while | take-while | takeWhile | takeWhile | Custom function | +| uniq | set | Set.empty | Data.Set | `lib.unique` | +| where | filter, filterv, select | filter, filterMap | filter | `filter` | +