Code: Select all
> (defun it-nth (n x) (dotimes (i n (first x)) (pop x)))
IT-NTH
> (setf foo '(a b c d e f))
(A B C D E F)
> (it-nth 4 foo)
E
> foo
(A B C D E F)
Code: Select all
> (defun it-nth (n x) (dotimes (i n (first x)) (pop x)))
IT-NTH
> (setf foo '(a b c d e f))
(A B C D E F)
> (it-nth 4 foo)
E
> foo
(A B C D E F)
Well I think this is wrong nevertheless as a literal list is modified here...Code: Select all
(setf foo '(a b c)) (setf bar '(d e f)) (setf foo (nconc foo bar)) ; <= correct
Yes, indeed, that doesn't work.learningcommonlisp wrote:Well I think this is wrong nevertheless as a literal list is modified here...