keysort/2¶
keysort(+ L, S)* is iso
Assuming L is a list of the form _Key_- _Value_
, keysort(+ _L_, _S_)
unifies S with the list obtained from L, by sorting its elements according to the value of Key.
?- keysort([3-a,1-b,2-c,1-a,1-b],S).
would return:
S = [1-b,1-a,1-b,2-c,3-a]