问题
Morning -
I'm trying to see if there is a way to check if an item returned from a list is a list itself.
For example
(elt '(a (b c) d) 1)
Is there a way to check that the item returned is a list?
I tried using length,
(length (elt '(a (b c) d) 1))
but if it is given an item that is not a list it throws an error.
In short I'm looking for a way to go through each element of a list and check if it is a list or not.
Thank you
回答1:
the listp tells you that :
(listp (elt '(a (b c) d) 1))
来源:https://stackoverflow.com/questions/12512143/how-to-check-if-an-item-returned-is-a-list-itself