Functional Programming And Capture-Avoiding Substitution - Computer Science Assignment Help

Download Solution Order New Solution
Assignment Task

 

Variables 

Next, we will build a function that generates a fresh variable. First, we create an infinite supply of variables; then we remove those already in use. We will store used variables as an alphabetically sorted list, with each variable mentioned at most once: we only care if variables occur, and not how often. To help with this you are given the merge function from the merge sort algorithm in the tutorials

 

Assignment : 

 

a) Complete the infinite list variables, which contains the variables "a" through "z", then repeats these suffixed with 1, "a1",...,"z1", then 2, "a2",...,"z2", etc. 

*Main> [variables !! i | i <- [0,1,25,26,27,100,3039]] ["a","b","z","a1","b1","w3","x116"] 

 

b) Complete the function filterVariables which takes two lists of variables and re turns the first with all variables from the second list removed from it. 

*Main> filterVariables ["y","z","a1","a2"] ["y","a1","a3"] ["z","a2"] 

 

c) Complete the function fresh which given a list of variables, generates a fresh variable not occurring in the list. Use filterVariables to remove the given variables from variables, then take the first variable in the remaining list. 

*Main> fresh ["a","b","x"] 

"c" 

 

d) Complete the function used that collects all the variable names used in a Term, both as a Variable and in a Lambda abstraction. Return them in an ordered list (use merge to combine two ordered lists into one). 

*Main> used example 

["a","b","x","y"]

 

 


This Computer Science Assignment has been solved by our Computer Science experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.