Merges list1 and list2 in O(n) time. The result is a sorted list of items from both lists, with all duplicates removed.

Duplicates are detected using the supplied predicate same?. Items are taken from list1 when duplicates are detected.

The procedure assumes list1 and list2 are sorted in ascending order according to the supplied predicate less-than?. More formally, for each pair of consecutive items a and b in either list, (less-than?ab) must be #t.

Merges alist1 and alist2, merging colliding keys together. prefer determines which alist the value is taken from if keys collide. equal? is used as a key comparison function. The order of keys is preserved where possible.