@end defun
@defun flatten-tree tree
-Take @var{tree} and "flatten" it.
-This always returns a list containing all the terminal nodes, or
-leaves, of @var{tree}. Dotted pairs are flattened as well, and nil
-elements are removed.
+This function returns a ``flattened'' copy of @var{tree}, that is,
+a list containing all the non-@code{nil} terminal nodes, or leaves, of
+the tree of cons cells rooted at @var{tree}. Leaves in the returned
+list are in the same order as in @var{tree}.
@end defun
@example
@end example
@defun number-sequence from &optional to separation
-This returns a list of numbers starting with @var{from} and
+This function returns a list of numbers starting with @var{from} and
incrementing by @var{separation}, and ending at or just before
@var{to}. @var{separation} can be positive or negative and defaults
to 1. If @var{to} is @code{nil} or numerically equal to @var{from},
file)
(defun flatten-tree (tree)
- "Take TREE and \"flatten\" it.
-This always returns a list containing all the terminal nodes, or
-\"leaves\", of TREE. Dotted pairs are flattened as well, and nil
-elements are removed.
+ "Return a \"flattened\" copy of TREE.
+In other words, return a list of the non-nil terminal nodes, or
+leaves, of the tree of cons cells rooted at TREE. Leaves in the
+returned list are in the same order as in TREE.
\(flatten-tree \\='(1 (2 . 3) nil (4 5 (6)) 7))
-=> (1 2 3 4 5 6 7)
-
-TREE can be anything that can be made into a list. For each
-element in TREE, if it is a cons cell return its car
-recursively. Otherwise return the element."
+=> (1 2 3 4 5 6 7)"
(let (elems)
(while (consp tree)
(let ((elem (pop tree)))