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:
Simon Forman
2018-06-06 08:47:26 -07:00
parent 22f7c6da00
commit 0de5029c98
52 changed files with 2502 additions and 280 deletions
+3 -47
View File
@@ -4,8 +4,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Treating Trees II\n",
"Let's consider a tree structure, similar to one described [\"Why functional programming matters\" by John Hughes](https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf), that consists of a node value followed by a sequence of zero or more child trees. (The asterisk is meant to indicate the [Kleene star](https://en.wikipedia.org/wiki/Kleene_star).)\n",
"# Treating Trees II: `treestep`\n",
"Let's consider a tree structure, similar to one described [\"Why functional programming matters\" by John Hughes](https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf), that consists of a node value followed by zero or more child trees. (The asterisk is meant to indicate the [Kleene star](https://en.wikipedia.org/wiki/Kleene_star).)\n",
"\n",
" tree = [] | [node tree*]"
]
@@ -14,7 +14,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## `treestep`\n",
"In the spirit of `step` we are going to define a combinator `treestep` which expects a tree and three additional items: a base-case function `[B]`, and two quoted programs `[N]` and `[C]`.\n",
"\n",
" tree [B] [N] [C] treestep"
@@ -829,42 +828,6 @@
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"from joy.library import FunctionWrapper\n",
"from joy.utils.stack import pushback\n",
"\n",
"\n",
"@FunctionWrapper\n",
"def cmp_(stack, expression, dictionary):\n",
" '''\n",
" cmp takes two values and three quoted programs on the stack and runs\n",
" one of the three depending on the results of comparing the two values:\n",
"\n",
" a b [G] [E] [L] cmp\n",
" ------------------------- a > b\n",
" G\n",
"\n",
" a b [G] [E] [L] cmp\n",
" ------------------------- a = b\n",
" E\n",
"\n",
" a b [G] [E] [L] cmp\n",
" ------------------------- a < b\n",
" L\n",
" '''\n",
" L, (E, (G, (b, (a, stack)))) = stack\n",
" expression = pushback(G if a > b else L if a < b else E, expression)\n",
" return stack, expression, dictionary\n",
"\n",
"\n",
"D['cmp'] = cmp_"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
@@ -886,7 +849,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 24,
"metadata": {},
"outputs": [
{
@@ -906,13 +869,6 @@
"\n",
"''')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {