Cell Distribution Rule

Contents

Cell Distribution Rule#

Syntax#

*[a [b c] d]        [*[a b c] *[a d]] 

Explanation#

When a formula’s head is a cell (not an atom/opcode), Nock treats both parts as separate formulas and returns a cell of their results.

  1. If the formula is [[b c] d] where [b c] is a cell.

  2. Evaluate [b c] as a formula to produce a result A.

  3. Evaluate d as a formula to produce a result B.

  4. Return the cell [A B].

This is equivalent to Lisp’s cons as an implicit operation. It’s recognizable by cell-headed formulas slots.

:subject 42
Subject set to: 42

Evaluate with two constants:

[[1 10] [1 20]]
[10 20]

Pair a slot and an increment:

[[0 1] [4 0 1]]
[42 43]

A more complex nested distribution:

[[[0 1] [0 1]] [4 0 1]]
[[42 42] 43]