Lukas-Fabian Moser <l...@gmx.de> writes:

> Hi Luca,
>
> without having tested your code: You're using append! wrong.
>
> From the Guile documentation: "append! is permitted, but not required, to
> modify the given lists to form its return."
> So the exclamation mark does not imply that your list gets modified
> in-place, but rather that you don't care whether or not append! changes
> your original list. So try
>
> (set! fl (append fl ...))
>
> where you could probably also use append! instead of append (I imagine it
> might be more efficient).

Most pertinent:

(append! '() ...)

cannot modify an empty list in-place because there is only one empty
list in the whole system and it is an unchangeable constant.

Indeed Guile happens to modify the given list in-place with append!
whenever it can, but it is impossible for the empty list.

-- 
David Kastrup

Reply via email to