From 00cbfeb201c0accd1418237b0f8c3c5f943ef02e Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 10 Dec 2020 22:07:35 -0500 Subject: =?UTF-8?q?Add=20specification=20for=20basic=20arithmetic=20+-?= =?UTF-8?q?=C3=97=C3=B7=E2=8B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/index.html | 2 +- docs/spec/primitive.html | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 docs/spec/primitive.html (limited to 'docs') diff --git a/docs/spec/index.html b/docs/spec/index.html index 6d85d9bb..42cd8f3b 100644 --- a/docs/spec/index.html +++ b/docs/spec/index.html @@ -14,7 +14,7 @@
  • Grammar
  • Variable scoping
  • Evaluation semantics
  • -
  • Primitives (reference implementations)
  • +
  • Primitives (reference implementations)
  • Inferred properties (type, Undo, and Under)
  • System-provided values (โ€ข)
  • diff --git a/docs/spec/primitive.html b/docs/spec/primitive.html new file mode 100644 index 00000000..36a22cfb --- /dev/null +++ b/docs/spec/primitive.html @@ -0,0 +1,25 @@ + + + + Specification: BQN primitives + + +

    Specification: BQN primitives

    +

    Most primitives are specified by the BQN-based implementation in reference.bqn. This document specifies the basic functionality required by those definitions. Descriptions of other primitives are for informational purposes only.

    +

    Arithmetic

    +

    Functions here are defined for atoms only; the reference implementations extend them to arrays.

    +

    BQN uses five arithmetic functions that are standard in mathematics. The precision of these operations should be specified by the number type.

    + +

    The three higher functions ร—, รท, and โ‹† apply to numbers and no other atomic types. + and - apply to numbers, and possibly also to characters, according to the rules of the affine character type:

    + +

    In the first two cases, if the result would not be a valid Unicode code point, then an error results. The remaining cases of + and - (adding two characters; negating a character or subtracting it from a number) are not allowed.

    -- cgit v1.2.3