The sort is done according to the standard ordering of prolog terms. Duplicates are not removed. See compare/3 for this standard ordering.
Note msort(L1,L2) is equivalent to sort(0,=<,L1,L2) except that msort/2 keeps duplicates whereas sort/2 removes them.
Success: msort([3,2,1,2,3],[1,2,2,3,3]). msort([2,4,6],L). (gives L=[2,4,6]). msort([2,4,6,1,7,3],L). (gives L=[1,2,3,4,6,7]). Fail: msort([1,5,3,7],[1,3,7,5]). Error: msort(List1,List2). (Error 4). msort("[1]",L). (Error 5).