/ HackerRank Functional Challenges

HR F#: Lambda Calculus - Evaluating Expressions #3

Although the Lambda Calculus - Evaluating Expressions #3 is probably the most simple of all the functional problems on Hackerrank (it is quite easy to solve it and even more easy to guess the right answer), it references the precious gem of the functional world: Church encoding.

Under Church encoding, what natural number does the expression \(λx.λy.x^{47}y\) represent?

Of course, the answer is 47. But the Church encoding is very nice, indeed.

Alex Netkachov

Alex Netkachov

Alex likes functional programming and algorithms. Apart from programming, his favourites are walking with his family in the parks and national trails and reading about universe and history.

Read More