Q1. [15 Points] Write a Prolog predicate makeset (L1, L2) that takes list L1 of integers and
removes the repeating elements. The result is returned in list L2. For example,
makeset ([1,3, 4,1, 3, 91, Set). will assign [1, 3, 4, 91 to set.
Q2. [15 Points]
Copyright By PowCoder代写 加微信 powcoder
triple (X, XXX) :- append(X, X, XX), append (XX, X, XXX)
append (x,
append (Xx,
The rule above checks if X triples into XXX. For example, if X=[1,2,3], this will produce [1, 2, 3,
1, 2, 3, 1, 2, 31 in XXX.
Rewrite this rule so that for X=[1, 2, 31, XXX is equal to [1, 1, 1, 2, 2, 2, 3, 3, 31.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com