Kelly Murray wrote:
> My recommendation is neither:
> I've become a LOOP convert ;)
>
Yuck! :-)
How about the Series package (from the CMU Archives):
(let ((lst (scan '(a b c d e f))))
(values (collect-last lst)
(collect-length lst)))
which macro expands into
(COMMON-LISP:LET (#:ITEM-483 #:LISTPTR-478 LST (#:NUMBER-486 0))
(DECLARE (TYPE LIST #:LISTPTR-478) (TYPE FIXNUM #:NUMBER-486))
(SETQ #:LISTPTR-478 '(A B C D E F))
(SETQ #:ITEM-483 NIL)
(SETQ #:NUMBER-486 0)
(TAGBODY
#:LL-489
(IF (ENDP #:LISTPTR-478) (GO SERIES::END))
(SETQ LST (CAR #:LISTPTR-478))
(SETQ #:LISTPTR-478 (CDR #:LISTPTR-478))
(SETQ #:ITEM-483 LST)
(INCF #:NUMBER-486)
(GO #:LL-489)
SERIES::END)
(VALUES #:ITEM-483 #:NUMBER-486))
which is about as efficient as any other version.
Ray
--
---------------------------------------------------------------------------
----> Raymond Toy ยทยทยทยท@mindspring.com
http://www.mindspring.com/~rtoy