Question: Write a predicate mydecode / 2 that takes the compressed list as a first parameter and returns the uncompressed list as shown as the second

Write a predicate mydecode/2 that takes the compressed list as a first parameter and returns the uncompressed list as shown as the second parameter. For example:
mydecode([],X) should yield X =[].
mydecode([(a,1),(b,2),(c,3),(d,2)],X) should yield X =['a','b','b','c','c','c','d','d'].
mydecode([(a,1),(p,2),(l,1),(e,1)],X) should yield X =['a','p','p','l','e'].
In Prolog please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!