From c358718f7585bfe615a2590a090d98002ab2a44e Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 15 Apr 2021 08:29:19 -0400 Subject: =?UTF-8?q?=E2=80=A2Show=20and=20=E2=80=A2Exit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/system.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/spec/system.html b/docs/spec/system.html index b2378648..eeb02814 100644 --- a/docs/spec/system.html +++ b/docs/spec/system.html @@ -62,6 +62,10 @@ •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.

@@ -69,6 +73,7 @@

•args is the arguments passed as the file was invoked, either from the command line or •Import. For command line calls it is a list of strings.

•path simply gives the path of the file in which it appears. It includes a trailing slash but not the name of the file itself.

•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.

When a •file function returns a file path or portion of a path, the path is always absolute and canonical, with . and .. components removed.

@@ -265,12 +270,16 @@ 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

-- cgit v1.2.3