Thanks!

--- On Fri, 30/4/10, Sam Steingold <sds@gnu.org> wrote:

From: Sam Steingold <sds@gnu.org>
Subject: Re: hang on (mapcon #'(lambda (x) (print x)) '(1 2 3 4))
To: "Angel Popov" <angelpopov@yahoo.com>
Cc: "cdev" <clisp-devel@lists.sourceforge.net>
Date: Friday, 30 April, 2010, 5:58 PM

Angel Popov wrote:
> [1]> (mapcon #'(lambda (x) (print x)) '(1 2 3 4))
>
> (1 2 3 4)
> (2 3 4)
> *** - Ctrl-C: User break
> The following restarts are available:
> ABORT :R1 Abort main loop
> Break 1 [2]>

mapcon calls nconc which modifies its arguments, producing a circular list on which is cannot operate.

use either
(ext:maplap #'(lambda (x) (print x)) '(1 2 3 4))
or
(mapcon #'(lambda (x) (copy-list (print x))) '(1 2 3 4))

both print
(1 2 3 4)
(2 3 4)
(3 4)
(4)
and return
(1 2 3 4 2 3 4 3 4 4)

http://clisp.cons.org/impnotes/faq.html#faq-self-mod
http://clisp.cons.org/impnotes/faq.html#faq-fine