Unlist function

Unlist is the same as unlist, but doesn't recurse all the way to preserve the type. This function is not well optimised.