From 19890e5695aa910b544b1e4c467ffeceb37be33b Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Tue, 14 Feb 2023 07:56:27 -0800 Subject: [PATCH] Minor edits. --- docs/notebooks/BigInts.ipynb | 1705 +++++++++++++++++++++++++--------- 1 file changed, 1285 insertions(+), 420 deletions(-) diff --git a/docs/notebooks/BigInts.ipynb b/docs/notebooks/BigInts.ipynb index fb75d04..e07fb71 100644 --- a/docs/notebooks/BigInts.ipynb +++ b/docs/notebooks/BigInts.ipynb @@ -21,15 +21,7 @@ "execution_count": 1, "id": "08a49b81", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2147483648" - ] - } - ], + "outputs": [], "source": [ "1 31 << " ] @@ -47,15 +39,7 @@ "execution_count": 2, "id": "628aa432", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[2147483648]" - ] - } - ], + "outputs": [], "source": [ "unit " ] @@ -65,15 +49,7 @@ "execution_count": 3, "id": "b52e0112", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[base 2147483648]" - ] - } - ], + "outputs": [], "source": [ "[base] swoncat" ] @@ -83,13 +59,7 @@ "execution_count": 4, "id": "b34d58ef", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [] - } - ], + "outputs": [], "source": [ " inscribe" ] @@ -115,13 +85,7 @@ "execution_count": 5, "id": "35476eac", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [] - } - ], + "outputs": [], "source": [ "[valid_digit [0 >] [base <] &&] inscribe" ] @@ -686,7 +650,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 26, "id": "818f51bc", "metadata": {}, "outputs": [ @@ -710,7 +674,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 27, "id": "d15747ee", "metadata": {}, "outputs": [ @@ -730,7 +694,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 28, "id": "c77d58c5", "metadata": {}, "outputs": [ @@ -750,7 +714,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 29, "id": "b2b076c9", "metadata": {}, "outputs": [ @@ -768,7 +732,7 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 30, "id": "778ecfb2", "metadata": {}, "outputs": [ @@ -786,7 +750,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 31, "id": "682ed5e2", "metadata": {}, "outputs": [ @@ -804,7 +768,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 32, "id": "5bb0973a", "metadata": {}, "outputs": [ @@ -830,7 +794,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 33, "id": "4736f46a", "metadata": {}, "outputs": [ @@ -848,7 +812,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 34, "id": "8615243e", "metadata": {}, "outputs": [ @@ -874,7 +838,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 35, "id": "e2f8d6cb", "metadata": {}, "outputs": [ @@ -900,7 +864,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 36, "id": "e09c99c2", "metadata": {}, "outputs": [ @@ -926,7 +890,7 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 37, "id": "cc990e1e", "metadata": {}, "outputs": [ @@ -954,6 +918,18 @@ " from-bigint == foo bar" ] }, + { + "cell_type": "markdown", + "id": "511b6bac", + "metadata": {}, + "source": [ + "(I just realize that if you pre-swap the two quoted programs in ``foo`` then you can omit ``swap`` from ``bar``.)\n", + "\n", + " foo == [prep from-bigint'] [first] cleave\n", + " bar == [] [neg] branch\n", + " from-bigint == foo bar" + ] + }, { "cell_type": "markdown", "id": "8bffedec", @@ -964,8 +940,8 @@ }, { "cell_type": "code", - "execution_count": 64, - "id": "fb5d4a30", + "execution_count": 38, + "id": "25591061", "metadata": {}, "outputs": [ { @@ -976,14 +952,14 @@ ], "source": [ "clear\n", - "[foo [first] [prep from-bigint'] cleave] inscribe\n", - "[bar swap [neg] [] branch] inscribe\n", + "[foo [prep from-bigint'] [first] cleave] inscribe\n", + "[bar [neg] [] branch] inscribe\n", "[from-bigint foo bar] inscribe" ] }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 39, "id": "b897a3bd", "metadata": {}, "outputs": [ @@ -1001,7 +977,7 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 40, "id": "d1efc1ae", "metadata": {}, "outputs": [ @@ -1019,7 +995,7 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 41, "id": "1ad99efa", "metadata": {}, "outputs": [ @@ -1075,7 +1051,7 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 42, "id": "f33ca7b0", "metadata": {}, "outputs": [ @@ -1107,7 +1083,7 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 43, "id": "b2d4f3b2", "metadata": {}, "outputs": [ @@ -1133,7 +1109,7 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 44, "id": "d87fa971", "metadata": {}, "outputs": [ @@ -1183,7 +1159,7 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 45, "id": "491c0846", "metadata": {}, "outputs": [ @@ -1234,7 +1210,7 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 46, "id": "bd51792f", "metadata": {}, "outputs": [ @@ -1259,7 +1235,7 @@ }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 47, "id": "fbf134e2", "metadata": {}, "outputs": [ @@ -1277,7 +1253,7 @@ }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 48, "id": "90db3359", "metadata": {}, "outputs": [ @@ -1333,7 +1309,7 @@ }, { "cell_type": "code", - "execution_count": 75, + "execution_count": 49, "id": "4fce2757", "metadata": {}, "outputs": [ @@ -1359,7 +1335,7 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 50, "id": "e86b7b90", "metadata": {}, "outputs": [ @@ -1386,7 +1362,7 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 51, "id": "cd70e18e", "metadata": {}, "outputs": [ @@ -1406,7 +1382,7 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 52, "id": "a27ff9f0", "metadata": {}, "outputs": [ @@ -1436,7 +1412,7 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 53, "id": "74a59ab5", "metadata": {}, "outputs": [ @@ -1456,7 +1432,7 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": 54, "id": "3a8f5078", "metadata": {}, "outputs": [ @@ -1499,7 +1475,7 @@ }, { "cell_type": "code", - "execution_count": 81, + "execution_count": 55, "id": "c05bcd8e", "metadata": {}, "outputs": [ @@ -1526,7 +1502,7 @@ }, { "cell_type": "code", - "execution_count": 82, + "execution_count": 56, "id": "03649114", "metadata": {}, "outputs": [ @@ -1546,7 +1522,7 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 57, "id": "9dca0fbc", "metadata": {}, "outputs": [ @@ -1566,7 +1542,7 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 58, "id": "c8f01d7d", "metadata": {}, "outputs": [ @@ -1586,7 +1562,7 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 59, "id": "a1e77990", "metadata": {}, "outputs": [ @@ -1606,7 +1582,7 @@ }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 60, "id": "b46a62ba", "metadata": {}, "outputs": [ @@ -1731,7 +1707,7 @@ }, { "cell_type": "code", - "execution_count": 87, + "execution_count": 61, "id": "c8f1aa44", "metadata": {}, "outputs": [ @@ -1761,7 +1737,7 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 62, "id": "1fa115d9", "metadata": {}, "outputs": [ @@ -1781,7 +1757,7 @@ }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 63, "id": "79d9c526", "metadata": {}, "outputs": [ @@ -1801,7 +1777,7 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": 64, "id": "bb030214", "metadata": {}, "outputs": [ @@ -1821,7 +1797,7 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 65, "id": "5e0a05af", "metadata": {}, "outputs": [ @@ -1841,7 +1817,7 @@ }, { "cell_type": "code", - "execution_count": 92, + "execution_count": 66, "id": "7c730d6d", "metadata": {}, "outputs": [ @@ -1859,7 +1835,7 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 67, "id": "33bc080f", "metadata": {}, "outputs": [ @@ -1883,12 +1859,12 @@ "#### Both lists empty\n", "If both lists are empty we discard one list and check the carry to determine our result as decribed above:\n", "\n", - " ELSE ≡ pop swap [] [1 swons] branch" + " ELSE == pop swap [] [1 swons] branch" ] }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 68, "id": "1ac813da", "metadata": {}, "outputs": [ @@ -1912,7 +1888,7 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 69, "id": "5e5ddf74", "metadata": {}, "outputs": [ @@ -1932,7 +1908,7 @@ }, { "cell_type": "code", - "execution_count": 96, + "execution_count": 70, "id": "c57d1fb2", "metadata": {}, "outputs": [ @@ -1952,7 +1928,7 @@ }, { "cell_type": "code", - "execution_count": 97, + "execution_count": 71, "id": "59b1338c", "metadata": {}, "outputs": [ @@ -2014,7 +1990,7 @@ }, { "cell_type": "code", - "execution_count": 98, + "execution_count": 72, "id": "78dec757", "metadata": {}, "outputs": [ @@ -2043,10 +2019,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 73, "id": "5b4bd2fe", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 4 [2 3] [5 6]" + ] + } + ], "source": [ "clear\n", "\n", @@ -2057,10 +2041,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 74, "id": "f284ea19", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -2101,10 +2091,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 75, "id": "8adffacb", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[add-digits initial-carry add-digits'] inscribe\n", "[add-digits' [P] [THEN] [R0] [R1] genrec] inscribe\n", @@ -2120,60 +2116,108 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 76, "id": "5b2e5738", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[3 2 1] [1 1 1]" + ] + } + ], "source": [ "[3 2 1] [1 1 1]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 77, "id": "cd7ac0b9", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[4 3 2]" + ] + } + ], "source": [ "add-digits" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 78, "id": "50f2e62c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[4 3 2] [2147483647]" + ] + } + ], "source": [ "base -- unit" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 79, "id": "54ca630f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[3 4 2]" + ] + } + ], "source": [ "add-digits" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 80, "id": "27bb4638", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[3 4 2] [2147483647 2147483647 2147483647]" + ] + } + ], "source": [ "base -- dup dup unit ccons" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 81, "id": "4d2d446a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[2 4 2 1]" + ] + } + ], "source": [ "add-digits" ] @@ -2188,10 +2232,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 82, "id": "c187ffff", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1242" + ] + } + ], "source": [ "clear 243 999 +" ] @@ -2216,10 +2268,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 83, "id": "f2987cd7", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 123] [true 456]" + ] + } + ], "source": [ "clear\n", "\n", @@ -2228,20 +2288,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 84, "id": "393623c3", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "[first] ii xor not" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 85, "id": "20ce6f9f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 123] [true 456]" + ] + } + ], "source": [ "clear\n", "\n", @@ -2250,40 +2326,72 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 86, "id": "b355996b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true [123] [true 456]" + ] + } + ], "source": [ "[uncons] dip" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 87, "id": "3d4a27b1", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true [123] [456]" + ] + } + ], "source": [ "rest " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 88, "id": "ac5990b4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true [579]" + ] + } + ], "source": [ "add-digits" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 89, "id": "11b3384e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 579]" + ] + } + ], "source": [ " cons" ] @@ -2298,10 +2406,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 90, "id": "e75d711e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 579]" + ] + } + ], "source": [ "[same-sign [first] ii xor not] inscribe\n", "[add-like-bigints [uncons] dip rest add-digits cons] inscribe\n", @@ -2310,30 +2426,52 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 91, "id": "e69471ba", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 579] [true 2147483647]" + ] + } + ], "source": [ "base -- to-bigint" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 92, "id": "29963839", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 578 1]" + ] + } + ], "source": [ "add-bigints" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 93, "id": "dac1c858", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -2553,30 +2691,52 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 94, "id": "55f64814", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[sandwich swap [cons] dip swoncat] inscribe" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 95, "id": "04e2d0d0", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[B] [A] [C]" + ] + } + ], "source": [ "clear [B] [A] [C]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 96, "id": "a28d9323", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[A [B] C]" + ] + } + ], "source": [ "sandwich" ] @@ -2603,10 +2763,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 97, "id": "bc16275c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear\n", "[_foo0.0 [[ditch-empty-list] swoncat] dip] inscribe\n", @@ -2625,38 +2791,54 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 98, "id": "c517da7a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ditch-empty-list A] [pop B] [uncons-two [C] dipd]" + ] + } + ], "source": [ "[A] [B] [C] _foo0" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 99, "id": "3f482224", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[P] [[P'] [ditch-empty-list A] [pop B] ifte] [uncons-two [C] dipd]" + ] + } + ], "source": [ "_foo1" ] }, { "cell_type": "code", - "execution_count": null, - "id": "3a504505", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, + "execution_count": 100, "id": "4b90e664", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[P] [[P'] [ditch-empty-list add-carry-to-digits] [pop swap carry] ifte] [uncons-two [add-with-carry] dipd]" + ] + } + ], "source": [ "clear\n", "[add-carry-to-digits]\n", @@ -2688,18 +2870,18 @@ }, { "cell_type": "code", - "execution_count": null, - "id": "c816fa4b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, + "execution_count": 101, "id": "ff88e2c1", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false [3 2 1] [6 5 4] [P] [[P'] [ditch-empty-list add-carry-to-digits] [pop swap carry] ifte] [uncons-two [add-with-carry] dipd]" + ] + } + ], "source": [ "clear\n", "\n", @@ -2713,22 +2895,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 102, "id": "941a4426", "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[9 7 5]" + ] + } + ], "source": [ "[i cons] genrec" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 103, "id": "917600dd", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear\n", "[build-two-list-combiner _foo0 _foo1 [i cons]] inscribe\n", @@ -2737,10 +2933,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 104, "id": "21f6b0e4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false [3 2 1] [6 5 4] [P] [[P'] [ditch-empty-list add-carry-to-digits] [pop swap carry] ifte] [uncons-two [add-with-carry] dipd] [i cons]" + ] + } + ], "source": [ "clear\n", "\n", @@ -2750,30 +2954,54 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 105, "id": "4a8819fc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[9 7 5]" + ] + } + ], "source": [ "genrec" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 106, "id": "5d451c1e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[9 7 5]" + ] + } + ], "source": [ "[base 10] inscribe" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 107, "id": "28fefe8a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 6 5 4 3 2 1]" + ] + } + ], "source": [ "clear\n", "\n", @@ -2785,10 +3013,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 108, "id": "fa37c40c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -2805,10 +3039,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 109, "id": "850a1421", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[P] [[P'] [ditch-empty-list add-carry-to-digits] [pop swap carry] ifte] [uncons-two [add-with-carry] dipd] [i cons]" + ] + } + ], "source": [ "[add-carry-to-digits]\n", "[swap carry]\n", @@ -2826,20 +3068,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 110, "id": "4b6005fc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[add-digits' [P] [[P'] [ditch-empty-list add-carry-to-digits] [pop swap carry] ifte] [uncons-two [add-with-carry] dipd] [i cons] genrec]" + ] + } + ], "source": [ "[genrec] ccons ccons [add-digits'] swoncat" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 111, "id": "c616033e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ " inscribe" ] @@ -2854,40 +3110,70 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 112, "id": "1a18ddd7", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[7 5 3]" + ] + } + ], "source": [ "false [3 2 1] [4 3 2] add-digits'" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 113, "id": "3c639487", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false [7 5 3] [9]" + ] + } + ], "source": [ "false swap base -- unit" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 114, "id": "c9222cab", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[6 6 3]" + ] + } + ], "source": [ "add-digits'" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 115, "id": "f3bc8d28", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -2902,102 +3188,92 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 116, "id": "b4a71b70", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 4 3 2 1] [true 9 9 9]" + ] + } + ], "source": [ "1234 999 [to-bigint] ii " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 117, "id": "6aba84ae", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 3 3 2 2]" + ] + } + ], "source": [ "add-bigints" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 118, "id": "d5dc4dce", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2233" + ] + } + ], "source": [ "from-bigint" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 119, "id": "2e9ab2c2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2233 2233" + ] + } + ], "source": [ "1234 999 +" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 120, "id": "080d81a3", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "7b237ca8", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "46f50f12", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7e035a2c", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f2492e55", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8dfddc89", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7f2bf0e5", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "id": "13336d40", @@ -3043,20 +3319,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 121, "id": "9c50bd24", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ - "[length [bool not] [pop 0] [rest] [i ++] genrec] inscribe" + "[length [pop ++] step_zero] inscribe" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 122, "id": "4c1dbabd", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0" + ] + } + ], "source": [ "clear\n", "[] length" @@ -3064,10 +3354,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 123, "id": "ef683ade", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4" + ] + } + ], "source": [ "clear\n", "[this is a list] length" @@ -3075,10 +3373,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 124, "id": "ff52920a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1 2 3] [4 5] 3 2" + ] + } + ], "source": [ "clear\n", "[1 2 3] [4 5] over over [length] app2" @@ -3086,10 +3392,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 125, "id": "be946f53", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[4 5] [1 2 3]" + ] + } + ], "source": [ "[swap][6][7]cmp" ] @@ -3104,30 +3418,52 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 126, "id": "056e3072", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 127, "id": "02d4e38e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ - "[1 2 3] [4 5 6] [bool]ii &" + "[1 2 3] [4 5 6] [bool] ii &" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 128, "id": "5683eb84", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1 4] [2 5] [3 6]]" + ] + } + ], "source": [ "clear\n", "[1 2 3] [4 5 6]\n", @@ -3140,10 +3476,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 129, "id": "a4e1f728", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1 4] [2 5] [3 6]]" + ] + } + ], "source": [ "clear\n", "[1 2 3] [4 5 6]\n", @@ -3156,10 +3500,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 130, "id": "dc7c151a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -3210,20 +3560,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 131, "id": "50c2669a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ " [xR1 uncons-two [unit cons swons] dipd] inscribe" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 132, "id": "1bbf3465", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[] [3 2 1] [4 5 6]" + ] + } + ], "source": [ "clear\n", "\n", @@ -3232,20 +3596,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 133, "id": "5a9347f6", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1 6] [2 5] [3 4]] [] []" + ] + } + ], "source": [ "xR1 xR1 xR1" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 134, "id": "69b18847", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear\n", "[xP [bool] ii & not] inscribe" @@ -3253,10 +3631,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 135, "id": "0b29370d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[2 4] [3 5]] [1] []" + ] + } + ], "source": [ "clear\n", "\n", @@ -3265,10 +3651,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 136, "id": "32ce148e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[2 5] [3 4]] [] [1]" + ] + } + ], "source": [ "clear\n", "\n", @@ -3277,10 +3671,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 137, "id": "4efc8f76", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1 3] [2 4] [3 5]] [] []" + ] + } + ], "source": [ "clear\n", "\n", @@ -3298,14 +3700,11 @@ "\n", "The second two are the tails of the original lists.\n", "\n", - "if the first list is non-empty then the second list must be empty so the whole function should return true\n", - "\n", - "if the first list is empty and the second list isn't then the whole function should return false\n", - "\n", - "\n", - "if both lists are empty we start comparing uncons'd pairs until we find an un-equal pair or run out of pairs.\n", + "If the top list is non-empty then the second list must be empty so the whole function should return true\n", "\n", + "If the top list is empty and the second list isn't then the whole function should return false\n", "\n", + "If both lists are empty we start comparing uncons'd pairs until we find an un-equal pair or run out of pairs.\n", "\n", " [bool] # if the first list is non-empty\n", " [popop pop true]\n", @@ -3325,10 +3724,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 138, "id": "7d973f7f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear\n", "[][][1]\n", @@ -3346,10 +3753,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 139, "id": "9239e0c4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false" + ] + } + ], "source": [ "clear\n", "[][1][]\n", @@ -3367,10 +3782,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 140, "id": "0c58a6e0", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[23 1]" + ] + } + ], "source": [ "clear\n", "[1][][]\n", @@ -3415,10 +3838,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 141, "id": "7f302157", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear\n", "\n", @@ -3427,10 +3858,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 142, "id": "d25ef02e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true true true]" + ] + } + ], "source": [ "clear\n", "\n", @@ -3447,10 +3886,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 143, "id": "06e0ffcb", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear\n", "\n", @@ -3468,20 +3913,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 144, "id": "b2428f49", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [[1 3] [2 4] [3 5]] compare-pairs" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 145, "id": "4ef5f503", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [[1 3] [3 3] [3 5]] compare-pairs" ] @@ -3496,10 +3957,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 146, "id": "7f060f83", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear\n", "\n", @@ -3525,70 +3992,124 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 147, "id": "8d74a801", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [[1 0] [2 2] [3 3]] compare-pairs" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 148, "id": "0104d2b0", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [[1 1] [2 2] [3 3]] compare-pairs" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 149, "id": "4728d141", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [[1 2] [2 2] [3 3]] compare-pairs" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 150, "id": "bfb5e62c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 151, "id": "7983881c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [[1 1] [2 1] [3 3]] compare-pairs" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 152, "id": "677757c5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [[1 1] [2 2] [3 3]] compare-pairs" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 153, "id": "5691f813", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [[1 1] [2 3] [3 3]] compare-pairs" ] @@ -3603,10 +4124,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 154, "id": "b95fe984", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear\n", "[[1 1] [2 1] [3 3]] [] []\n", @@ -3624,10 +4153,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 155, "id": "b5ddac15", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "[BASE\n", " [bool]\n", @@ -3644,10 +4181,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 156, "id": "d4077376", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[] [3 2 1] [4 5 6]" + ] + } + ], "source": [ "clear\n", "\n", @@ -3656,20 +4201,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 157, "id": "ac840996", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "[xP] [BASE] [xR1] tailrec" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 158, "id": "e7c3b141", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[] [4 5 6] [3 2 1]" + ] + } + ], "source": [ "clear\n", "\n", @@ -3678,20 +4239,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 159, "id": "95c7308d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false" + ] + } + ], "source": [ "[xP] [BASE] [xR1] tailrec" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 160, "id": "5e43ba80", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[] [3 2 1] [3 2 1]" + ] + } + ], "source": [ "clear\n", "\n", @@ -3700,60 +4277,104 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 161, "id": "20070426", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "[xP] [BASE] [xR1] tailrec" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 162, "id": "c97b0df9", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 163, "id": "980a1bbf", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[gt-bigint <<{} [xP] [BASE] [xR1] tailrec] inscribe" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 164, "id": "4f429421", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [3 2 1] [4 5 6] gt-bigint" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 165, "id": "5a6419ee", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false" + ] + } + ], "source": [ "clear [3 2 1] [4 5 6] swap gt-bigint" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 166, "id": "cd586291", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true" + ] + } + ], "source": [ "clear [3 2 1] dup gt-bigint" ] @@ -3768,20 +4389,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 167, "id": "35fb22d2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[4 5 6] [3 2 1]" + ] + } + ], "source": [ "clear [3 2 1] [4 5 6] [gt-bigint] [swap] [] ifte" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 168, "id": "36d74e5b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[4 5 6] [3 2 1]" + ] + } + ], "source": [ "clear [4 5 6] [3 2 1] [gt-bigint] [swap] [] ifte" ] @@ -3804,10 +4441,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 169, "id": "dd645337", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear\n", "[check-gt [gt-bigint] [swap [not] dipd] [] ifte] inscribe" @@ -3815,30 +4458,52 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 170, "id": "935552d4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false [4 5 6] [3 2 1]" + ] + } + ], "source": [ "false [4 5 6] [3 2 1]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 171, "id": "05100765", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false [4 5 6] [3 2 1]" + ] + } + ], "source": [ "check-gt" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 172, "id": "7ac873d4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -3942,10 +4607,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 173, "id": "c360cc7b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[_sub-with-carry0 rolldown bool-to-int [-] ii] inscribe\n", "[_sub-with-carry1 [base + base mod] [0 <] cleave] inscribe\n", @@ -3954,32 +4625,54 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 174, "id": "3a84adff", "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false 3 9" + ] + } + ], "source": [ "clear false 3 base --" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 175, "id": "0dcdc968", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4 true" + ] + } + ], "source": [ "sub-with-carry" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 176, "id": "2d60492d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -4046,10 +4739,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 177, "id": "20c8ad40", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[sub-carry-from-digits\n", " [pop not]\n", @@ -4071,10 +4770,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 178, "id": "92201303", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[3 2 1]" + ] + } + ], "source": [ "clear\n", "\n", @@ -4083,10 +4790,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 179, "id": "1a1d7cdc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[9 0]" + ] + } + ], "source": [ "clear\n", "\n", @@ -4095,10 +4810,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 180, "id": "39ce9c6a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[2 2 1]" + ] + } + ], "source": [ "clear\n", "\n", @@ -4107,10 +4830,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 181, "id": "a93e916e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[9 9 0]" + ] + } + ], "source": [ "clear\n", "\n", @@ -4119,10 +4850,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 182, "id": "c2273ff3", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -4141,20 +4878,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 183, "id": "d8c7f7a5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] inscribe" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 184, "id": "875aaafa", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[sub-carry-from-digits\n", " [pop not]\n", @@ -4167,20 +4916,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 185, "id": "bd2447b6", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[_scfd_R0 uncons 0 swap [sub-with-carry] dip] inscribe" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 186, "id": "ffaf1fcc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[9 9]" + ] + } + ], "source": [ "clear\n", "\n", @@ -4189,10 +4952,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 187, "id": "8a2b2165", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -4209,10 +4978,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 188, "id": "c22775e9", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[sub-like-bigints [uncons] dip rest check-gt sub-digits cons] inscribe\n", "[sub-digits initial-carry sub-digits'] inscribe\n", @@ -4227,10 +5002,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 189, "id": "ac670030", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true [3 2 1] [6 5 4]" + ] + } + ], "source": [ "clear\n", "true [3 2 1] [6 5 4]" @@ -4238,30 +5021,54 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 190, "id": "c19ff340", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false false [6 5 4] [3 2 1]" + ] + } + ], "source": [ "check-gt initial-carry" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 191, "id": "8fbba815", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "false [3 3 3]" + ] + } + ], "source": [ "sub-digits'" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 192, "id": "3b05693f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 5 4 3 2 1] [true 9 0 1]" + ] + } + ], "source": [ "clear\n", "12345 to-bigint 109 to-bigint" @@ -4269,30 +5076,52 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 193, "id": "fc69485b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[true 6 3 2 2 1]" + ] + } + ], "source": [ "sub-like-bigints" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 194, "id": "c992d25a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "12236" + ] + } + ], "source": [ "from-bigint" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 195, "id": "90abab0f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear" ] @@ -4307,50 +5136,86 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 196, "id": "391d87fe", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "[neg-bigint [not] infra] inscribe" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 197, "id": "a7cce3f2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "123" + ] + } + ], "source": [ "123 " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 198, "id": "edb25ebd", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-123" + ] + } + ], "source": [ "to-bigint neg-bigint from-bigint" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 199, "id": "06e2f309", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "123" + ] + } + ], "source": [ "to-bigint neg-bigint from-bigint" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 200, "id": "dd47bdae", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [] + } + ], "source": [ "clear\n", "[sub-bigints [same-sign] [sub-like-bigints] [neg-bigint add-like-bigints] ifte] inscribe\n",