πŸ’Ύ Archived View for dcreager.net β€Ί concatenative β€Ί simpler-cons.gmi captured on 2024-02-05 at 09:32:57. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-11-14)

-=-=-=-=-=-=-

Defining β€˜cons’ with only empty quotations

2023-11-07

In Swanson, I'm currently treating stack values and quotations separately, similar to how CBPV and FMC have a clear distinction between values and computations. Concretely, that means that my original definition of β€˜cons’ in the natural linear basis (shown below) won't work, since β€˜[unit]’ would be a stack value containing an instruction. I need a different definition of β€˜cons’, which uses only the instructions in the natural basis, and which only uses empty quotations (i.e. Sβ‚€'s β€˜nil’ instruction).

The natural linear concatenative basis

Call By Push Value (CBPV)

Functional Machine Calculus (FMC)

cons β‰œ swap unit swap cat

          ┃ [B] [A] cons
          ┃ [B] [A] swap unit swap cat
      [B] ┃ [A] swap unit swap cat
  [B] [A] ┃ swap unit swap cat
  [A] [B] ┃ unit swap cat
[A] [[B]] ┃ swap cat
[[B]] [A] ┃ cat
  [[B] A] ┃

Turns out that's a better definition not only because it doesn't depend on quoted programs; it's just simpler overall! Can we do the same with β€˜sap’?

A simpler definition of β€˜sap’

Original definition

For reference, here is the original definition that used a quoted program:

cons β‰œ [unit] swap unit cat i cat

                 ┃ [B] [A] cons
                 ┃ [B] [A] [unit] swap unit cat i cat
             [B] ┃ [A] [unit] swap unit cat i cat
         [B] [A] ┃ [unit] swap unit cat i cat
  [B] [A] [unit] ┃ swap unit cat i cat
  [B] [unit] [A] ┃ unit cat i cat
[B] [unit] [[A]] ┃ cat i cat
  [B] [unit [A]] ┃ i cat
             [B] ┃ unit [A] cat
           [[B]] ┃ [A] cat
       [[B]] [A] ┃ cat
         [[B] A] ┃