aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Stewart <stewinsalot@gmail.com>2015-08-11 15:38:20 -0700
committerStewart Stewart <stewinsalot@gmail.com>2015-08-11 15:49:09 -0700
commited7cb7df9d52f88e94ecf5996c43fb534a2624c9 (patch)
treecf13b016a04a5fdaca496177ba0d8179547954b8
parent285a314c4db6c52f80414598c04872fd252e829d (diff)
downloadspn-combinatory-logic-ed7cb7df9d52f88e94ecf5996c43fb534a2624c9.tar.gz
spn-combinatory-logic-ed7cb7df9d52f88e94ecf5996c43fb534a2624c9.tar.bz2
spn-combinatory-logic-ed7cb7df9d52f88e94ecf5996c43fb534a2624c9.zip
Added a cheat sheet to README.md
-rw-r--r--README.md57
1 files changed, 57 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..88e9705
--- /dev/null
+++ b/README.md
@@ -0,0 +1,57 @@
+## Cheat Sheet
+
+#### Syntax
+ <term> ::= <atom> | <combination>
+ <atom> ::= <constant> | <variable>
+ <combination> ::= (<term><term>)
+
+eg. constants: **I, K, S,** etc.\
+eg. variables: _x, y, z_\
+eg. combination: **I**_x_, _yz_, ((_yz_)(**I**_x_))
+
+Given distinct terms `p, q, r, s`, the following properties hold:
+ - non-commutative: `pq != qp`
+ - non-associative: `p(qr) != (pq)r`
+ - left-associative: `pqrs == (((pq)r)s)`
+
+Typically, we omit parens where possible:
+((_yz_)(**I**_x_)) as above is simply _yz_(**I**_x_).
+
+
+Check out the parse tree for this term: [S(BBS)(KK)SI](http://mshang.ca/syntree/?i=%5B*%20%5B*%20%5B*%20%5B*%20%5BS%5D%20%5B*%20%5B*%20%5BB%5D%20%5BB%5D%5D%20%5BS%5D%5D%5D%20%5B*%20%5BK%5D%20%5BK%5D%5D%5D%20%5BS%5D%5D%20%5BI%5D%5D%0A%0A)
+
+#### Reduction Rules
+The combinators have the follwing reduction properties. Given arbitrary terms, `p, q, r, s`:
+
+```
+Ip -> p
+Kpq -> p
+Bpqr -> p(qr)
+Cpqr -> prq
+Spqr -> pr(qr)
+Wpq -> pqq
+B'pqrs -> pq(rs)
+C'pqrs -> p(qs)r
+S'pqrs -> p(qs)(rs)
+```
+
+If a term begins with one of these patterns the head can be reduced to form a new term. e.g:
+
+```Bpqrstuv -> p(qr)stuv```
+
+The term `S(KS)Kpqr` reduces as follows:
+
+```
+S(KS)Kpqr
+S(KS)Kpq
+KSp(Kp)q
+S(Kp)q
+S(Kp)qr
+Kpr(qr)
+p(qr)
+```
+
+#### Running:
+
+As in a typical project: `sbt test` and `sbt compile` will test and compile your code.
+With utest, you can run `test-only -- Tests --trace=false` in sbt to supress the stack trace.