Bumped version to 0.2.0; docs edits.
I've added cond and cmp to the library so that should bump the minor version no. I think.
This commit is contained in:
@@ -386,7 +386,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Now we can define `Tree-add`\n",
|
||||
"### Now we can define `Tree-add`\n",
|
||||
" Tree-add == [popop not] [[pop] dipd Tree-new] [] [[P >] [T] [E] ifte] genrec\n",
|
||||
"\n",
|
||||
"Putting it all together:\n",
|
||||
@@ -415,7 +415,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Examples"
|
||||
"### Examples"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -751,7 +751,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Processing the current node.\n",
|
||||
"#### Processing the current node.\n",
|
||||
"\n",
|
||||
"`R0` is almost certainly going to use `dup` to make a copy of the node and then `dip` on some function to process the copy with it:\n",
|
||||
"\n",
|
||||
@@ -771,7 +771,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Recur\n",
|
||||
"#### Recur\n",
|
||||
"Now `R1` needs to apply `[Tree-iter]` to `left` and `right`. If we drop the key and value from the node using `rest` twice we are left with an interesting situation:\n",
|
||||
"\n",
|
||||
" key [key value left right] [Tree-iter] R1\n",
|
||||
@@ -829,7 +829,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## `Tree-iter`\n",
|
||||
"### `Tree-iter`\n",
|
||||
"\n",
|
||||
" Tree-iter == [not] [pop] roll< [dupdip rest rest] cons [step] genrec"
|
||||
]
|
||||
@@ -847,7 +847,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Examples"
|
||||
"### Examples"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1011,7 +1011,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Process the left child.\n",
|
||||
"### Process the left child.\n",
|
||||
"Staring at this for a bit suggests `dup third` to start:\n",
|
||||
"\n",
|
||||
" [key value left right] R0 [Tree-iter-order] R1\n",
|
||||
@@ -1035,7 +1035,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Process the current node.\n",
|
||||
"### Process the current node.\n",
|
||||
"So far, so good. Now we need to process the current node's values:\n",
|
||||
"\n",
|
||||
" left Tree-iter-order [key value left right] [Tree-iter-order] [[F] dupdip] dip\n",
|
||||
@@ -1052,7 +1052,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Process the right child.\n",
|
||||
"### Process the right child.\n",
|
||||
"First ditch the rest of the node and get the right child:\n",
|
||||
"\n",
|
||||
" left Tree-iter-order key [key value left right] [Tree-iter-order] [rest rest rest first] dip\n",
|
||||
@@ -1068,7 +1068,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Defining `Tree-iter-order`\n",
|
||||
"### Defining `Tree-iter-order`\n",
|
||||
"The result is a little awkward:\n",
|
||||
"\n",
|
||||
" R1 == [cons dip] dupdip [[F] dupdip] dip [rest rest rest first] dip i\n",
|
||||
@@ -1163,7 +1163,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### The base case `[]`\n",
|
||||
"### The base case `[]`\n",
|
||||
"As before, the stopping predicate just has to detect the empty list:\n",
|
||||
"\n",
|
||||
" Tree-get == [pop not] [E] [R0] [R1] genrec\n",
|
||||
@@ -1186,7 +1186,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Node case `[key value left right]`\n",
|
||||
"### Node case `[key value left right]`\n",
|
||||
"Now we need to figure out `R0` and `R1`: \n",
|
||||
"\n",
|
||||
" [key value left right] key R0 [BTree-get] R1\n",
|
||||
@@ -1200,7 +1200,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Predicate:\n",
|
||||
"#### Predicate\n",
|
||||
"\n",
|
||||
" P == over [get-node-key] nullary\n",
|
||||
" get-node-key == pop popop first\n",
|
||||
@@ -1386,7 +1386,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Tree-delete\n",
|
||||
"## Tree-delete\n",
|
||||
"\n",
|
||||
"Now let's write a function that can return a tree datastructure with a key, value pair deleted:\n",
|
||||
"\n",
|
||||
|
||||
Reference in New Issue
Block a user