From 770cd783fa4670a65057ea1f42da753ea9ba2f19 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Thu, 25 Nov 2021 11:10:21 -0800 Subject: [PATCH] More changes to the zipper notebook. --- docs/Zipper.ipynb | 168 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 139 insertions(+), 29 deletions(-) diff --git a/docs/Zipper.ipynb b/docs/Zipper.ipynb index 18b6d5b..719c7f1 100644 --- a/docs/Zipper.ipynb +++ b/docs/Zipper.ipynb @@ -212,9 +212,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1] [8] [2] [7] [4 3] [6] 625" + ] + } + ], "source": [ "sqr" ] @@ -228,39 +236,50 @@ "name": "stdout", "output_type": "stream", "text": [ - "!= % & * + ++ - -- / // /floor < << <= <> = > >= >> ^ _Tree_add_Ee _Tree_delete_R0 _Tree_delete_clear_stuff _Tree_get_E abs add and app1 app2 app3 at b bool branch ccons choice clear cmp concat cond cons dip dipd dipdd disenstacken div divmod drop dup dupd dupdd dupdip eq first first_two floor floordiv fourth gcd2 ge genrec getitem gt help i id infra inscribe le loop lshift lt map max min mod modulus mul ne neg not or over parse pick pm pop popd popdd popop popopd popopdd pow pred primrec rem remainder remove rest reverse roll< roll> rolldown rollup round rrest rshift second select sharing shunt sort sqrt stack step stuncons stununcons sub succ sum swaack swap swons take third times trace truthy tuck uncons unique unit unswons void warranty words x xor z-down z-left z-right z-up zip •\n", + "[1] [8] [2] [7] [4 3] [6] 625 • z-up\n", + "[1] [8] [2] [7] [4 3] [6] 625 • swons swap shunt\n", + "[1] [8] [2] [7] [4 3] [625 6] • swap shunt\n", + "[1] [8] [2] [7] [625 6] [4 3] • shunt\n", + " [1] [8] [2] [7] [3 4 625 6] • \n", "\n", - "[1] [8] [2] [7] [4 3] [6] 25" + "[1] [8] [2] [7] [3 4 625 6]" ] } ], - "source": [ - "words" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], "source": [ "[z-up] trace" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1] [8] [2 [3 4 625 6] 7]" + ] + } + ], "source": [ "z-up" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1 [2 [3 4 625 6] 7] 8]" + ] + } + ], "source": [ "z-up" ] @@ -275,9 +294,43 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1 [2 [3 4 625 6] 7] 8] [[[[[[sqr] dipd] infra] dip] infra] dip] • infra\n", + " 8 [2 [3 4 625 6] 7] 1 • [[[[[sqr] dipd] infra] dip] infra] dip [] swaack\n", + " 8 [2 [3 4 625 6] 7] 1 [[[[[sqr] dipd] infra] dip] infra] • dip [] swaack\n", + " 8 [2 [3 4 625 6] 7] • [[[[sqr] dipd] infra] dip] infra 1 [] swaack\n", + " 8 [2 [3 4 625 6] 7] [[[[sqr] dipd] infra] dip] • infra 1 [] swaack\n", + " 7 [3 4 625 6] 2 • [[[sqr] dipd] infra] dip [8] swaack 1 [] swaack\n", + " 7 [3 4 625 6] 2 [[[sqr] dipd] infra] • dip [8] swaack 1 [] swaack\n", + " 7 [3 4 625 6] • [[sqr] dipd] infra 2 [8] swaack 1 [] swaack\n", + " 7 [3 4 625 6] [[sqr] dipd] • infra 2 [8] swaack 1 [] swaack\n", + " 6 625 4 3 • [sqr] dipd [7] swaack 2 [8] swaack 1 [] swaack\n", + " 6 625 4 3 [sqr] • dipd [7] swaack 2 [8] swaack 1 [] swaack\n", + " 6 625 • sqr 4 3 [7] swaack 2 [8] swaack 1 [] swaack\n", + " 6 625 • dup * 4 3 [7] swaack 2 [8] swaack 1 [] swaack\n", + " 6 625 625 • * 4 3 [7] swaack 2 [8] swaack 1 [] swaack\n", + " 6 390625 • 4 3 [7] swaack 2 [8] swaack 1 [] swaack\n", + " 6 390625 4 • 3 [7] swaack 2 [8] swaack 1 [] swaack\n", + " 6 390625 4 3 • [7] swaack 2 [8] swaack 1 [] swaack\n", + " 6 390625 4 3 [7] • swaack 2 [8] swaack 1 [] swaack\n", + " 7 [3 4 390625 6] • 2 [8] swaack 1 [] swaack\n", + " 7 [3 4 390625 6] 2 • [8] swaack 1 [] swaack\n", + " 7 [3 4 390625 6] 2 [8] • swaack 1 [] swaack\n", + " 8 [2 [3 4 390625 6] 7] • 1 [] swaack\n", + " 8 [2 [3 4 390625 6] 7] 1 • [] swaack\n", + " 8 [2 [3 4 390625 6] 7] 1 [] • swaack\n", + " [1 [2 [3 4 390625 6] 7] 8] • \n", + "\n", + "[1 [2 [3 4 390625 6] 7] 8]" + ] + } + ], "source": [ "[[[[[[sqr] dipd] infra] dip] infra] dip] [infra] trace" ] @@ -300,18 +353,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[Z [[] ccons] step i] inscribe" ] @@ -325,18 +390,55 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " 1 [2 3 4] • Z\n", + " 1 [2 3 4] • [[] ccons] step i\n", + " 1 [2 3 4] [[] ccons] • step i\n", + " 1 2 [[] ccons] • i [3 4] [[] ccons] step i\n", + " 1 2 • [] ccons [3 4] [[] ccons] step i\n", + " 1 2 [] • ccons [3 4] [[] ccons] step i\n", + " [1 2] • [3 4] [[] ccons] step i\n", + " [1 2] [3 4] • [[] ccons] step i\n", + " [1 2] [3 4] [[] ccons] • step i\n", + " [1 2] 3 [[] ccons] • i [4] [[] ccons] step i\n", + " [1 2] 3 • [] ccons [4] [[] ccons] step i\n", + " [1 2] 3 [] • ccons [4] [[] ccons] step i\n", + " [[1 2] 3] • [4] [[] ccons] step i\n", + " [[1 2] 3] [4] • [[] ccons] step i\n", + "[[1 2] 3] [4] [[] ccons] • step i\n", + " [[1 2] 3] 4 [[] ccons] • i i\n", + " [[1 2] 3] 4 • [] ccons i\n", + " [[1 2] 3] 4 [] • ccons i\n", + " [[[1 2] 3] 4] • i\n", + " • [[1 2] 3] 4\n", + " [[1 2] 3] • 4\n", + " [[1 2] 3] 4 • \n", + "\n", + "[[1 2] 3] 4" + ] + } + ], "source": [ "1 [2 3 4] [Z] trace" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -350,9 +452,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1 [2 [3 4 625 6] 7] 8]" + ] + } + ], "source": [ "[1 [2 [3 4 25 6] 7] 8] [sqr] [dip dip infra dip infra dip infra] Z" ]