Hello,
I recently learned that a list is defined as either the empty list or a pair where the second element is a list. For example:
#;2> (list? (cons 1 (cons 2 (cons 3 (cons 4 (cons 5 '()))))))
#t
#;3> (list? (cons 1 (cons 2 (cons 3 (cons 4 (cons 5 6))))))
#f
Does this mean that "list?" is O(n) on the list length? In other words, you cannot know whether a pair is a list until you have visited every node all the way to the end, till you hit '().
Cheers,
Daniel.
--
When an engineer says that something can't be done, it's a code phrase that means it's not fun to do.