

nim cc \
-d:release \
--stackTrace:off \
--lineTrace:off \
--checks:off \
--assertions:off \
--debugger:native \
joy.nim

nim doc --project --index:on --git.url:"https://git.sr.ht/~sforman/Bliss" --git.commit:10b5651ed242fb16c29f2c1f7340d77f65926ca4 --outdir:htmldocs joy.nim

https://git.sr.ht/~sforman/Bliss/tree/10b5651ed242fb16c29f2c1f7340d77f65926ca4/item/types.nim#L26




## Documentation

§.3.1 Jupyter Notebooks

The docs/ folder contains Jupyter notebooks, ... TODO

§.3.2 Sphinx Docs

Some of the documentation is in the form of ReST files

§.3.3 Building the Docs

Building the documentation is a little tricky at the moment.  It involves
a makefile that uses nbconvert to generate ReST files from some of the
notebooks, copies those to the sphinx source dir, then builds the HTML
output using sphinx.

Get the dependencies for (re)building the docs:

    pip install Thun[build-docs]
    make docs








Nothing is done about Python exceptions currently, although it would be
possible to capture the stack and expression just before the exception
and build a robust and flexible error handler.  Because they are both
just datastructures, you could immediately retry them under a debugger,
or edit either or both of the stack and expression.  All state is in one
or the other.



















### AND, OR, XOR, NOT

There are three families (categories?) of these operations:

1. Logical ops that take and return Boolean values.
2. Bitwise ops that treat integers as bit-strings.
3. Short-Circuiting Combinators that accept two quoted programs
   and run top quote *iff* the second doesn't suffice to resolve the clause.
   (in other words `[A] [B] and` runs `B` only if `A` evaluates to `true`,
   and similarly for `or` but only if `A` evaluates to `false`.)

(So far, only the Elm interpreter implements the bitwise ops.  The others
two kinds of ops are defined in the `defs.txt` file, but you could implement
them in host language for greater efficiency if you like.)

| op  | Logical (Boolean) | Bitwise (Ints) | Short-Circuiting Combinators |
|-----|-------------------|----------------|------------------------------|
| AND |       `/\`        |     `&&`       |          `and `              |
|  OR |       `\/`        |    `\|\|`      |          `or`                |
| XOR |      `_\/_`       |    `xor`       |                              |
| NOT |      `not`        |                |                              |





## An Interesting Variation


    codireco == cons dip rest cons')


    [0 [dup ++] codireco] x


                                     . [0 [dup ++] codireco] x
               [0 [dup ++] codireco] . x
               [0 [dup ++] codireco] . 0 [dup ++] codireco
             [0 [dup ++] codireco] 0 . [dup ++] codireco
    [0 [dup ++] codireco] 0 [dup ++] . codireco
    [0 [dup ++] codireco] 0 [dup ++] . cons dip rest cons
    [0 [dup ++] codireco] [0 dup ++] . dip rest cons
                                     . 0 dup ++ [0 [dup ++] codireco] rest cons
                                   0 . dup ++ [0 [dup ++] codireco] rest cons
                                 0 0 . ++ [0 [dup ++] codireco] rest cons
                                 0 1 . [0 [dup ++] codireco] rest cons
           0 1 [0 [dup ++] codireco] . rest cons
             0 1 [[dup ++] codireco] . cons
             0 [1 [dup ++] codireco] . 



```python
define('G == [codireco] cons cons')
```


```python
J('230 [dup ++] G 5 [x] times pop')
```

    230 231 232 233 234

