100% Guaranteed Results


PPL212 – PPL Assignment 5 Solved
$ 20.99
Category:

Description

5/5 – (1 vote)

Question 1: CPS
1.1 b)

Question 2: Lazy lists
d) reduce1-lzl – In a case I want to get the sum(or any other binary func) of all values. example: I want to count the value of all the coins in my pocket.
g) Generate-pi-approximation is using lazy-list evaluation , which means that no memory has to be stored somewhere , and even an infinity list can represent that way. Furthemore, Lazy evaluation such Generate-pi-approximation, is often combined with memoization, After a function’s value is computed for that parameter or set of parameters, the result is stored in a lookup table that is indexed by the values of those parameters.
The next time the function is called, the table is consulted to determine whether the result for that combination of parameter values is already available.
If so, the stored result is simply returned. If not, the function is evaluated and another entry is added to the lookup table for reuse.
That is why this Implementation is better than the Pi-sum one.
Although those facts, In the Pi-sum Implementation no Laziness methodology is used, but if you want to get only the values from the k’th to n’th indexes , you could do it, while in the Generate-pi-approximation you aren’t able to do so.
Question 3: Logic programing
3.1
a) unify[ t(s(s), G, s, p, t(K), s), t(s(G), G, s, p, t(K), U) ]
S = {}
A*s = t(s(s), G, s, p, t(K), s)
B*s = t(s(G), G, s, p, t(K), U)
S = S*{G = s} = {G = s}
A*s = t(s(s), s, s, p, t(K), s)
B*s = t(s(s), s, s, p, t(K), U)
S = S*{U = s} = {G = s, U = s}
A*s = t(s(s), s, s, p, t(K), s)
B*s = t(s(s), s, s, p, t(K), s)
⇒ S = {G = s, U = s}
b) unify[ p([v | [V | W]]), p([[v | V] | W]) ]
S = {}
A*s = p([v | [V | W]])
B*s = p([[v | V] | W])
⇒ FAIL: v != [ v | V ] not the same structure
3.3

Reviews

There are no reviews yet.

Be the first to review “PPL212 – PPL Assignment 5 Solved”

Your email address will not be published. Required fields are marked *

Related products