	function merge ( a, b : list ) : list;

	var	first, last, temp : list;
	begin
	first := nil;
	while b <> nil do
		if a = nil then	begin a := b;  b := nil end
		else	begin
			if b^.k > a^.k then
				begin temp := a; a := a^.next end
			else	begin temp := b; b := b^.next end;
			temp^.next := nil;
			tailins( temp, first, last )
			end;
	tailins( a, first, last );
	merge := first
	end;
