[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Easy to add with push but not to the end of a list
From: |
Dr Rainer Woitok |
Subject: |
Re: Easy to add with push but not to the end of a list |
Date: |
Tue, 29 Nov 2022 12:17:53 +0100 |
Emanuel,
On Monday, 2022-11-28 20:59:31 +0100, you wrote:
> ...
> (defun push-last (elem lst)
> (when (listp lst)
> (setcdr (last lst) (list elem))
> lst) )
I think
(push-last 1 nil)
would fail with an error message. But apart from the error checking,
why not just use
(nconc lst (list elem))
Sincerely,
Rainer
Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/11/28
Re: Easy to add with push but not to the end of a list,
Dr Rainer Woitok <=
Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/11/30