Updating the docs. Playing with Joy Kernel.

This commit is contained in:
Simon Forman 2021-11-24 08:54:08 -08:00
parent 876c68c02f
commit f7364a6161
4 changed files with 1574 additions and 17 deletions

View File

@ -314,9 +314,7 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": []
"We only want the terms *less than* 1000."
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
@ -1092,9 +1090,9 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
@ -1106,7 +1104,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.3" "version": "3.7.10"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -29,6 +29,42 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "cbc09c4a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"41 123"
]
}
],
"source": [
"123"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "f310ec86",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5043"
]
}
],
"source": [
"*"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "8d86c75f", "id": "8d86c75f",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -44,7 +80,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 5,
"id": "ff9b5754", "id": "ff9b5754",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -62,7 +98,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 6,
"id": "e1027ca3", "id": "e1027ca3",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -78,7 +114,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 7,
"id": "aef6f509", "id": "aef6f509",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -111,7 +147,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 8,
"id": "f491e33f", "id": "f491e33f",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -129,7 +165,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 9,
"id": "31d6ec54", "id": "31d6ec54",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -149,6 +185,111 @@
"source": [ "source": [
"trace" "trace"
] ]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "f85a149a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": []
}
],
"source": [
"clear"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "2e13763d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[dup cons]"
]
}
],
"source": [
"[dup cons]"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "e4509e6a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" [dup cons] • x\n",
" [dup cons] • dup cons\n",
"[dup cons] [dup cons] • cons\n",
"[[dup cons] dup cons] • \n",
"\n",
"[[dup cons] dup cons]"
]
}
],
"source": [
"[x] trace"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "8170053c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[dup cons] dup cons] • i\n",
" • [dup cons] dup cons\n",
" [dup cons] • dup cons\n",
"[dup cons] [dup cons] • cons\n",
"[[dup cons] dup cons] • \n",
"\n",
"[[dup cons] dup cons]"
]
}
],
"source": [
"[i] trace"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "50c24687",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": []
}
],
"source": [
"clear"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "21c86a84",
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

File diff suppressed because it is too large Load Diff

View File

@ -223,12 +223,13 @@ def BinaryBuiltinWrapper(f):
(a, (b, stack)) = stack (a, (b, stack)) = stack
except ValueError: except ValueError:
raise StackUnderflowError('Not enough values on stack.') raise StackUnderflowError('Not enough values on stack.')
if ( not isinstance(a, int) # Boolean predicates like "or" fail here. :(
or not isinstance(b, int) ## if ( not isinstance(a, int)
or isinstance(a, bool) # Because bools are ints in Python. ## or not isinstance(b, int)
or isinstance(b, bool) ## or isinstance(a, bool) # Because bools are ints in Python.
): ## or isinstance(b, bool)
raise NotAnIntError ## ):
## raise NotAnIntError
result = f(b, a) result = f(b, a)
return (result, stack), expression, dictionary return (result, stack), expression, dictionary
return inner return inner