The following code is intended to append two lists.
fun {AppendLists L1 L2}
if L1 == nil then L2
else
L1.1 | {AppendLists L1.2 L2}
end
end
This code is already tail-recursive. You have recursion as the last statement, so you are calculating the result first, and then call the recursion.