-
?- list_to_set([2,3,4,4,1,2], [2,3,4,1]).
%@ true. Hi, shouldn't this return True or am I overlooking some constraint or detail? 🦆 ?- list_to_set([2,3,4,4,1,2], [1,3,4,2]).
%@ false. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
One small note on terminology: "return" is terminology from functional programming; a predicate is true or holds.
Therefore, we indeed expect the predicate to hold in the first example, but not in the second one. |
Beta Was this translation helpful? Give feedback.
-
What is a function in functional programming often becomes a relation with functional dependencies in Prolog. |
Beta Was this translation helpful? Give feedback.
One small note on terminology: "return" is terminology from functional programming; a predicate is true or holds.
list_to_set(Xs, Ys)
relates the listXs
to a listYs
where each element ofXs
occurs exactly once, and the first occurrences of each element are in the same order in both lists.Therefore, we indeed expect the predicate to hold in the first example, but not in the second one.