Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lambda Calculus Pseudo Code Question - Create an applicative order interpreter for the Lambda Calculus, which yields an answer in Normal Form (i.e., the expression

Lambda Calculus Pseudo Code Question -

Create an applicative order interpreter for the Lambda Calculus, which yields an answer in Normal Form (i.e., the expression cannot be further reduced).

This link goes over applicative order vs normal order evaluation for Lambda calculus if you needed further information. https://cs.stackexchange.com/questions/54000/is-applicative-order-and-normal-order-evaluation-models-definition-contradictor

I'm only asking for pseudo code for this question, but my actual assignment requests that I complete this using the Haskell programming language, so do whichever you can please. If you would like to see the actual question I'm given, please see below

image text in transcribedimage text in transcribed

Next, you w-ill code the interpeeter in Haskell A Lambda expeessic is af the fallaming form, aa we discussed in clasi: dat pr AFP Exp Expr deriving ta,Shaa) the Expr data tyre derives Fron huilt-in a and shou le type Nare String vorioble nare Yire implemen the following fianetios Free variables. As a tirst step, wte tbe fiumcton lt takes expression exo^ and returns the lust of vanables that are free in expr wathout lepettuce. For example freevors app (Var "X" ) var "X )) velds"X,1. Generating new names.Nexr, geuerate fresh variables for a list of expressians by malking use of the infinite list of positive integers [..] Wrire a fanction It takes a list of expressions ana generates an infinite mplement fresars list ofvariables t at are nat free in an of the express ons in the list For example fr.hl. . L da "1 . (App (var x ) (App (var 1 ) (Var "z ))) y elds the n rlist 1- 4 Remember you will leverage 1 to Subsritution.Naxt, wrire the subatitrice funcrion per o nunz a suba n t cn ona an da ex resaon y.A w ere yms, L must almars re ace ran eter y w 1 t e next res variable-trom t te ist o r u ere a ity s not ree in and .t mould an e been sate to leave t as s or auto grad ng On u natty. L, necessar A single stop. Now write erion to do 8 *ingle gepofredietion atne the bui-i aybe type a dcfiod as foliows Nothing Just appF Onesteg takes an expsie If theze s a dex aalable ine, t pucks the cort upplicate de edex and redces e. (Note that in applicatave otdet wwe are pursu the letinst, maost strategy as tollows. Pak the lestnot redex R, if there are netd mer)edexes within , pack Next, you w-ill code the interpeeter in Haskell A Lambda expeessic is af the fallaming form, aa we discussed in clasi: dat pr AFP Exp Expr deriving ta,Shaa) the Expr data tyre derives Fron huilt-in a and shou le type Nare String vorioble nare Yire implemen the following fianetios Free variables. As a tirst step, wte tbe fiumcton lt takes expression exo^ and returns the lust of vanables that are free in expr wathout lepettuce. For example freevors app (Var "X" ) var "X )) velds"X,1. Generating new names.Nexr, geuerate fresh variables for a list of expressians by malking use of the infinite list of positive integers [..] Wrire a fanction It takes a list of expressions ana generates an infinite mplement fresars list ofvariables t at are nat free in an of the express ons in the list For example fr.hl. . L da "1 . (App (var x ) (App (var 1 ) (Var "z ))) y elds the n rlist 1- 4 Remember you will leverage 1 to Subsritution.Naxt, wrire the subatitrice funcrion per o nunz a suba n t cn ona an da ex resaon y.A w ere yms, L must almars re ace ran eter y w 1 t e next res variable-trom t te ist o r u ere a ity s not ree in and .t mould an e been sate to leave t as s or auto grad ng On u natty. L, necessar A single stop. Now write erion to do 8 *ingle gepofredietion atne the bui-i aybe type a dcfiod as foliows Nothing Just appF Onesteg takes an expsie If theze s a dex aalable ine, t pucks the cort upplicate de edex and redces e. (Note that in applicatave otdet wwe are pursu the letinst, maost strategy as tollows. Pak the lestnot redex R, if there are netd mer)edexes within , pack

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions