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,9],Set). would return [1,3,4,9].

Respuesta :

Answer and Explanation:

Using Javascript:

We could just use ES6 syntax and quickly get our result with no long coding. ECMA script 2015, the sixth version of javascript programming language has an array method that returns the unique values of an array in a new array.

var allValues = [ 1,3,4,1,3,9 ];

let uniqueValues = [...new Set(allValues)];

console.log(uniqueValues);

This will output only the unique values 1,3,4,9

ACCESS MORE
EDU ACCESS