Minor edits.

This commit is contained in:
sforman
2023-08-13 08:47:16 -07:00
parent 9f78b6d8fd
commit 1f5bea98b6
6 changed files with 94 additions and 233 deletions
+3 -1
View File
@@ -13,14 +13,16 @@ footer {
}
pre {
background: #eee;
font-size: large;
margin-left: 2em;
margin-right: 2em;
margin-bottom: 1em;
font-family: 'Inconsolata';
padding: 0.5em;
}
blockquote {
background: #eee;
background: #eee;
border-left: 0.2em solid black;
padding: 0.5em;
+1 -2
View File
@@ -4,6 +4,5 @@ https://www.youtube.com/watch?v=_IgqJr8jG8M
"Complete and Easy Bidirectional Typechecking
for Higher-Rank Polymorphism"
"Complete and Easy Bidirectional Typechecking for Higher-Rank Polymorphism"
+40
View File
@@ -284,3 +284,43 @@ List Manipulation
concat cons first
#############################################
Stashing this here for now
### 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` | | |
+3 -3
View File
@@ -49,9 +49,9 @@ For more information see [Square Spiral Example Joy Code](/notebooks/Square_Spir
square_spiral [_p] [_then] [_else] ifte
_p [_p0] [_p1] &&
_p [_p0] [_p1] and
_p0 [abs] ii <=
_p1 [<>] [pop !-] ||
_p1 [<>] [pop !-] or
_then [ !-] [[++]] [[--]] ifte dip
_else [pop !-] [--] [++] ifte
@@ -200,7 +200,7 @@ expression, and a dictionary, and it iterates through the expression
putting values onto the stack and delegating execution to functions which
it looks up in the dictionary.
![Joy Interpreter Flowchart](https://git.sr.ht/~sforman/Thun/blob/trunk/joy_interpreter_flowchart.svg)
![Joy Interpreter Flowchart](/joy_interpreter_flowchart.svg)
All control flow works by
[Continuation Passing Style](https://en.wikipedia.org/wiki/Continuation-passing_style).