[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: 'length' function for lists and cons cells?
From: |
Drew Adams |
Subject: |
RE: 'length' function for lists and cons cells? |
Date: |
Thu, 21 Mar 2013 15:05:16 -0700 |
> actually I'm looking for a way to distinguish between cons cells and
> regular lists to avoid the errors when mapping an alist that contains
> both with functions that work only on one of them, using 'length' was
> just a hack.
You distinguish them by the way they are distinguished ;-), i.e., by whether the
cdr of the last cons cell is non-nil.
A true list is either nil or a cons that has a true list as its cdr. This
implies that it has nil as the cdr of its last cons.
See my previous message.