The recursive nested function just takes the first element of the first argument, then swaps the arguments for the recursive call (minus that first element).
So given a list [1, 2, 3, 4]
, the outer call splits the list in two and the recursion then does:
([1, 2], [3, 4]) -> [1] + ([3, 4], [2])
([3, 4], [2]) -> [3] + ([2], [4])
([2], [4]) -> [2] + ([4], [])
([4], []) -> return [4] # lst2 is empty, return lst1
return [2] + [4]
return [3] + [2, 4]
return [1] + [3, 2, 4]