Not an interpreter. Arguably a compiler. But I'm talking about a transpiler.
It can be in any language, but it must return js-valid arrow notation code.
The λ-calculus string would be passed as an argument to a function, or the whole program, and in some way the program would return/log/print the string with the js-notation.
Whitespace is not important, if it makes the writing easier.
Only accepted answers are with curry notation for output, not multiple parameters. The λ-calculus notation shorthand for multiple parameters must be considered.
All identifiers will be separated either by a
() (parentheses). They can be more than a single character. Note that if the language has issues with keeping track of characters like
λ, then you can cut yourself some slack and use
The transpiler doesn't have to evaluate the expression to simplify it, but as long as the statement is equivalent, I'll allow it. It won't gain any extra points.
All unneeded parenthesis can be taken out.
x=>x is just as valid as
(x=>x) which is just as valid as
Efficiency isn't really important, as long as vaguely practical, so answer with least amount of bytes wins
λx.x -> (x)=>x λx y.x(y) -> (x)=>(y)=>x(y) λx.λy.x(y) -> (x)=>(y)=>x(y) λs z.s(s z) -> (s)=>(z)=>s(s(z)) λfoo bar.foo bar -> (foo)=>(bar)=>foo(bar) (λa b c.b c a) x y -> ((a)=>(b)=>(c)=>(b(c)(a)))(x)(y)