https://github.com/begriffs/master_forest
Combinatory logic parsing and reduction gem
https://github.com/begriffs/master_forest
Last synced: about 2 months ago
JSON representation
Combinatory logic parsing and reduction gem
- Host: GitHub
- URL: https://github.com/begriffs/master_forest
- Owner: begriffs
- License: mit
- Created: 2012-09-23T19:45:32.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-09-26T16:49:36.000Z (over 13 years ago)
- Last Synced: 2025-12-21T18:54:47.737Z (6 months ago)
- Language: Ruby
- Size: 141 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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`.