Question: Write a Python program, that given a lambda term in de Bruijn notation, displays it as a tree. As an example, the Python expression l(l(a(a(0,l(3)),a(l(0),0))))
Write a Python program, that given a lambda term in de Bruijn notation, displays it as a tree.
As an example, the Python expression l(l(a(a(0,l(3)),a(l(0),0)))) returns the tree ('l', ('l', ('a', ('a', 0, ('l', 3)), ('a', ('l', 0), 0))))
that can be displayed like this: l | | l | | a __|_ / \ a a | | / \ / \ 0 l l 0 | | | | 3 0
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
