aboutsummaryrefslogtreecommitdiff
path: root/spec/system.md
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-15 08:29:19 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-15 08:29:19 -0400
commitc358718f7585bfe615a2590a090d98002ab2a44e (patch)
tree913042bcf6c95e6cf517fa41d0c42f19b6cb0cb0 /spec/system.md
parentdac0ef523cbd97e5c8df8678489ef0b9c57badfb (diff)
•Show and •Exit
Diffstat (limited to 'spec/system.md')
-rw-r--r--spec/system.md14
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/system.md b/spec/system.md
index 01664e5e..dd17f471 100644
--- a/spec/system.md
+++ b/spec/system.md
@@ -29,6 +29,7 @@ The effect of `•Eval` should be the same as if its argument were written as so
| `•args` | Arguments passed to current file
| `•path` | Current file's path
| `•name` | Current filename
+| `•Exit` | Leave the top-level running program
`•Import` loads another BQN script. The script is evaluated in its own isolated scope, and its result is either the result of the last line, or a module if it exports with `⇐` at the top level. If it is a module, then it must be destructured immediately unless first-class namespaces are possible.
@@ -40,6 +41,8 @@ The right argument is a filename, which may be relative or absolute. Relative pa
`•name` gives the name, including the extension, of the file in which it appears. It doesn't include the path.
+`•Exit` immediately terminates the running BQN process. If the argument is a valid return code (on Unix, an integer), it is returned; otherwise, the default return code (the one returned when the end of the program is reached) is used.
+
## Files
The system namespace value `•file` deals with file operations. For the purposes of `•file`, paths in the filesystem are always strings. As with `•Import`, file paths may be relative or absolute, and relative paths are relative to `•path`, except in `•file.At` which allows `𝕨` to specify an alternate base directory. The value `•path` used for a particular instance of `•file` is determined by the file that contains that instance.
@@ -126,12 +129,13 @@ The following short names can also be provided for file access. They can be prov
## Input and output
-| Name | Summary
-|--------|----------------------
-| `•Out` | Print argument string
-| `•Fmt` | Format value for printing
+| Name | Summary
+|---------|----------------------
+| `•Out` | Print argument string
+| `•Show` | Print argument value
+| `•Fmt` | Format value for printing
-`•Out` prints to stdout, with a trailing newline. `•Fmt` returns a string (not a character table: lines are separated by linefeeds) indicating how `𝕩` would be printed by the interactive environment.
+`•Out` prints a string to stdout, with a trailing newline. `•Show` displays a BQN value to the programmer (the representation is not specified, and does not need to be plain text). `•Fmt` returns a string (not a character table: lines are separated by linefeeds) indicating how `𝕩` would be printed by the interactive environment. Both `•Show` and `•Fmt` may take a left argument configuring how the value should be formatted.
## Operation properties