abstract-algorithm
Advanced tools
Comparing version 0.1.10 to 0.1.11
@@ -90,4 +90,4 @@ // This implements an evaluator for arbitrary λ-calculus terms inside the | ||
console.log("Evaluating it with Lamping's algorithm (oracleless):"); | ||
console.log("Result:", A(lambda).term); | ||
console.log("Pretty:", show(A(lambda).term)); | ||
console.log("Result:", A(lambda)); | ||
console.log("Pretty:", show(A(lambda))); | ||
console.log(""); |
{ | ||
"name": "abstract-algorithm", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"description": "Abstract-algorithm for optional reduction of stratifiable lambda terms", | ||
@@ -26,4 +26,4 @@ "main": "src/abstract-algorithm.js", | ||
"dependencies": { | ||
"lambda-calculus": "^1.0.5" | ||
"lambda-calculus": "^1.0.6" | ||
} | ||
} |
# Lamping's Abstract Algorithm | ||
A cleaned up adaptation of [Lamping's abstract algorithm](http://dl.acm.org/citation.cfm?id=96711). It evaluates functions optimally by encoding a λ-term as ([symmetric](https://scholar.google.com.br/scholar?q=symmetric+interaction+combinators&hl=en&as_sdt=0&as_vis=1&oi=scholart&sa=X&ved=0ahUKEwjNgZbO7aTVAhUEkZAKHYyTAFgQgQMIJjAA)) [interaction combinators](http://www.sciencedirect.com/science/article/pii/S0890540197926432), normalizing the resulting graph, and decoding it back. It asymptotically beats all usual evaluators of functional programs, including Haskell's GHC, Scheme compilers, Google's V8 and so on. Moreover, it is capable of automatically exploiting any inherent parallelizability of your program, since interaction nets are a naturally concurrent model of computation. This implementation consists of two files, [a 120-loc reducer](src/abstract-algorithm.js) for interaction combinators and [a 71-loc conversor](https://github.com/MaiaVictor/abstract-algorithm/blob/master/src/lambda-encoder.js) of λ-terms to and from those. It isn't parallel, but is completely lazy: it doesn't perform any work that won't influence on the normal form. There is an inherent tradeoff between those. | ||
A cleaned up adaptation of [Lamping's abstract algorithm](http://dl.acm.org/citation.cfm?id=96711). It evaluates functions optimally by encoding a λ-term as ([symmetric](https://scholar.google.com.br/scholar?q=symmetric+interaction+combinators&hl=en&as_sdt=0&as_vis=1&oi=scholart&sa=X&ved=0ahUKEwjNgZbO7aTVAhUEkZAKHYyTAFgQgQMIJjAA)) [interaction combinators](http://www.sciencedirect.com/science/article/pii/S0890540197926432), normalizing the resulting graph, and decoding it back. It asymptotically beats all usual evaluators of functional programs, including Haskell's GHC, Scheme compilers, Google's V8 and so on. Moreover, it is capable of automatically exploiting any inherent parallelizability of your program, since interaction nets are a naturally concurrent model of computation. This implementation consists of two files, [a 121-loc reducer](src/interaction-combinators.js) for interaction combinators and [a 71-loc conversor](https://github.com/MaiaVictor/abstract-algorithm/blob/master/src/lambda-encoder.js) of λ-terms to and from those. It isn't parallel, but is completely lazy: it doesn't perform any work that won't influence on the normal form. There is an inherent tradeoff between those. | ||
@@ -5,0 +5,0 @@  |
@@ -21,5 +21,5 @@ // Encode/decode λ-terms to/from interaction nets. | ||
var app = I.Node(m,1); | ||
var fun = encode(term.left, scope); | ||
var fun = encode(term.func, scope); | ||
I.link(m, I.Wire(app,0), fun); | ||
var arg = encode(term.right, scope); | ||
var arg = encode(term.argm, scope); | ||
I.link(m, I.Wire(app,1), arg); | ||
@@ -26,0 +26,0 @@ return I.Wire(app,2); |
370932
Updatedlambda-calculus@^1.0.6