1

Good day, I'm a beginner in Java and I was wondering if, in Java, I'm able to do a beta reduction with a given lambda expression in Java. Basically lambda reduction is like this:
1.)
Expression : (λa.abc)x
Beta-Reduced Expression (without parenthesis) : xbc

2.) Expression :(λabc.abc)x)y)
Beta-Reduced Expression (without parenthesis) : λc.xyc

basically what I'm asking is, how do I approach this type of problem in Java? do I do it with strings, or? Just trying to learn :))

The next step would be parenthesizing, but I think it's quite complicated for me to do.

1 Answers1

1

You should probably parse the expression into a tree where a node can be a function applications or a lambda abstraction and then implement beta-reduction on the tree. Also implement pretty-printing the tree so you can see what is going on.