Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (23 sloc) 1.23 KB

Master Forest

This gem parses and reduces combinatory logic written in Lazy K syntax.

Usage

MasterForest::Term methods
initialize(string) argument is a Lazy K string
leaf? Is it a single letter like `s`, `k`, or `i`?
valid? Is it syntactically valid?
normal? Is it in normal form? (i.e. not further reducible)
to_s Serialize back to Lazy K
l Left applicand; nil if leaf
r Right applicand; nil if leaf
reduce Return single β reduction of term or term itself
fully_reduce(depth) Reduce depth times or until normal, default depth is ∞

Performance

This gem includes two implementations of the same functionality, MasterForest::Term and MasterForest::MemcacheTerm. If you run memcache then the latter will use it to memoize previous reductions. This goes much faster. You can test the speed by running benchmark/run.rb.

Something went wrong with that request. Please try again.