append with first argument optional nil
Posted: Mon Mar 21, 2005 12:34 pm
Attempt to made a more alisp compatibel append:
Any better solution?
Code: Select all
(define (append-nil alist )
(if alist
(begin
(setq _nlst alist)
(dolist (_lst (args))(setq _nlst(append _nlst _lst))))
(begin
(setq _nlst (list ))
(dolist (_lst (args))(setq _nlst(append _nlst _lst))))
))
Code: Select all
> (setq a '(1 2))
(1 2)
> (append-nil a '(3)'(4)'(5))
(1 2 3 4 5)
> (append-nil b '(3)'(4)'(5))
(3 4 5)
>