< > >= <= != <> =
- lshift rshift
+ not
- /\ \/ _\/_ (These are the logical ops that work on Booleans.)
+They could be grouped:
+- Combinators (`branch dip i loop`)
+- Stack Chatter (`clear dup pop stack swaack swap`)
+- List Manipulation (`concat cons first rest`)
+- Math (`+ - * / %`)
+- Comparison (`< > >= <= != <> =`)
+- Logic (`truthy not`)
+Many of these could be definitions, but we don't want to be completely minimal at the cost of efficiency, eh?
+
+ first == [[clear] dip] infra
+ rest == [pop] infra
+
+Also, custom error messages are nice? (E.g. `first` and `rest` have distinct errors from `pop` and `dip`, at least in the current design.)
+
+
+### 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 a Boolean and a quoted program
+ and run the quote *iff* the Boolean doesn't suffice to resolve the clause.
+ (in other words `true [P] and` runs `P` whereas `false [P] and` discards
+ it and leaves `false` on the stack, and similarly for `or` but with the
+ logical polarity, if you will, reversed.)
+
+(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 |
|-----|-------------------|----------------|------------------------------|
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright © 2022 Simon Forman
+#
+# This file is part of Thun
+#
+# Thun is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Thun is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Thun. If not see <http://www.gnu.org/licenses/>.
+#
'''
An exploration of Phil Bagwell's VList.