[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: (BUG LISP) at MIT-MC, (BUG LISPM) at MIT-MC
- From: HIC at MIT-MC (Howard I. Cannon)
- Date: Tue, 27 Jun 78 02:32:00 GMT
- Original-date: 26 JUN 1978 2232-EDT
This idea is from CWH/ALAN (and many others I am sure). I agree, comments?
(1) LENGTH should count the number of conses in a given structure, i.e.
(LENGTH '(A B . C)) --> 2. Here is how I think it should behave:
(defun length (list)
(cond ((atom list) 0)
(t (1+ (length (cdr list))))))
(2) LAST should return the last cons in a given structure, i.e.
(LAST '(A B . C)) --> (B . C). Here is a definition:
(defun last (list)
(cond ((atom (cdr list)) list)
(t (last (cdr list)))))
End of idea.