aboutsummaryrefslogtreecommitdiff
path: root/spec/system.md
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2023-03-10 20:07:42 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2023-03-10 20:07:42 -0500
commit1a5fa6f8c9474e06ff7938c37f77450bf4528d5a (patch)
treef1df187fa058cba7fe940201450a41fd74f4cc53 /spec/system.md
parent7ede372f216368fbb9c7a5243afb1f5ca0098248 (diff)
•ns specification
Diffstat (limited to 'spec/system.md')
-rw-r--r--spec/system.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/system.md b/spec/system.md
index fe216f2e..5412f090 100644
--- a/spec/system.md
+++ b/spec/system.md
@@ -16,6 +16,7 @@ All system values described in the BQN specification are optional: an implementa
| [Input and output](#input-and-output) ([terminal](#terminal-io)) | `•Out`, `•Show`, `•Repr`, `•Fmt`, …, `•term`
| [Interface](#interface) ([FFI](#foreign-function-interface)) | `•SH`, `•FFI`
| [Operation properties](#operation-properties) | `•Type`, `•Glyph`, `•Source`, `•Decompose`
+| [Namespaces](#namespaces) | `•ns`
| [Time](#time) | `•UnixTime`, `•Delay`, `•_timed`, …
| [Math](#math) | `•math`
| [Random generation](#random-generation) | `•rand`, `•MakeRand`
@@ -268,6 +269,18 @@ Each function in this section is monadic.
| 1-mod | 4 | `𝕗,𝕣`
| 2-mod | 5 | `𝕗,𝕣,𝕘`
+## Namespaces
+
+The system namespace `•ns` contains functionality for working with namespaces.
+
+| Name | Summary
+|--------|-------------------------------
+| `Keys` | List of normalized field names in `𝕩`
+| `Has` | `1` if `𝕨` contains a field named `𝕩` and `0` otherwise
+| `Get` | Current value in `𝕨` of the field named `𝕩`
+
+`Keys` returns field names as strings, normalized in the sense that all underscores are removed and alphabetic characters are converted to lowercase. The order of the names is unspecified. `Has` and `Get` accept names with any spelling. `Get` causes an error if `𝕩` isn't the name of a field of `𝕨`, while `Has` causes an error only if it isn't a string, returning `0` for any string that isn't a valid name.
+
## Time
| Name | Summary