Barry Margolin
7/30/2015 7:05:00 PM
In article <d10a6ff9-7d26-4088-a267-ce4bdee47224@googlegroups.com>,
ron@ronmitchell.co.uk wrote:
> Hi Pascal, thanks for the reply.
>
> Well, if I type (quote (1 2 3)) into the SBCL repl it comes back with (1 2
> 3).
>
> In terms of your code diagram this would be
>
> |
> v
> +---+---+ +---+---+ +---+---+
> | * | * |-->| * | * |-->| * |NIL|
> +---+---+ +---+---+ +---+---+
> | | |
> v v v
> +---+ +---+ +---+
> | 1 | | 2 | | 3 |
> +---+ +---+ +---+
>
> where the result is indicated by the top 'arrow' in the diagram.
>
> Ah, I think I might be beginning to see... Is the problem something to do
> with the fact that I am actually modifying the 'do' code itself?
Exactly. You're calling RPLACD on a literal list, so it's modifying the
list that's in the function definition.
Change your original function to use
(do ((l1 (list 1 2 3))
and the problem will go away.
P.S. you should have replied to Pascal's post, not your own original
post, so that the threading would be maintained properly. Usenet is not
a web forum (despite the fact that you're reading it in the forum-style
Google Groups), you can't treat it like it is.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***