I know that the concatenate function can be performed on strings, but
is there an easy function to do this to lists - I tried using
(concatenate '(1 2 3 4) '(5 6 7 8))
but it didn't work - thanks for any help
Richard Harrington wrote:
>
> I know that the concatenate function can be performed on strings, but
> is there an easy function to do this to lists - I tried using
>
> (concatenate '(1 2 3 4) '(5 6 7 8))
>
> but it didn't work - thanks for any help
[1]> (concatenate 'list '(1 2 3 4) '(5 6 7 8))
(1 2 3 4 5 6 7 8)
or
[2]> (append '(1 2 3 4) '(5 6 7 8))
(1 2 3 4 5 6 7 8)
In article <·················@uclink4.berkeley.edu>, Joseph Dale
<·····@uclink4.berkeley.edu> wrote:
>Richard Harrington wrote:
>>
>> I know that the concatenate function can be performed on strings, but
>> is there an easy function to do this to lists - I tried using
>>
>> (concatenate '(1 2 3 4) '(5 6 7 8))
>>
>> but it didn't work - thanks for any help
>
>[1]> (concatenate 'list '(1 2 3 4) '(5 6 7 8))
>(1 2 3 4 5 6 7 8)
>
>or
>
>[2]> (append '(1 2 3 4) '(5 6 7 8))
>(1 2 3 4 5 6 7 8)
or
[3] use NCONC if it is permissable to destructively alter the argument
lists (and the lists are not quoted):
? (nconc (list 1 2 3 4) (list 5 6 7 8))
(1 2 3 4 5 6 7 8)
?
i guess the last list can be a quoted without problems:
? (nconc (list 1 2 3 4) '(5 6 7 8))
(1 2 3 4 5 6 7 8)
?
sashank