Recursively flattens a nested list into a single flat list containing only the leaf values, preserving left-to-right order.
A bare (class-less) list is recursed into; NULL contributes no leaves;
everything else (a classed object, an atomic, a function, ...) is a leaf.
Use build_tree() to capture the nesting structure so it can be restored
with unflatten().
Value
list() containing the flattened values.