lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Move ambitus print callback to scheme


From: David Kastrup
Subject: Re: [PATCH] Move ambitus print callback to scheme
Date: Sat, 29 Aug 2009 06:56:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Carl Sorensen <address@hidden> writes:

> On Aug 28, 2009, at 1:16 PM, "Nicolas Sceaux" <address@hidden>  
> wrote:
>
>>
>> According to R5RS, it is an error to modify a literal list.
>> If a function returns '(), the caller won't be allowed to
>> apply a modifying function on the result (eg. append!)
>>
>
> IIUC, '() is not a literal list, but a constant that represents the  
> empty list.

It is a literal list in my opinion, but one that happens to have no
unique and/or modifiable conses.  Append will work just fine on it.

>> However, guile does not report modifying a literal list as an error,
>> and actually modifies it, so this is somewhat rhetorical.

It is not rhetorical since a modified literal list will actually stay
modified when you call the function the next time.  Can't happen with
'() though.

guile> (define (weird) (append! '(4) '(5)))
guile> (weird)
(4 5)
guile> (weird)
(4 5 . #1#)
guile> (weird)

Backtrace:
In standard input:
   7: 0* [weird]
   4: 1  [append! (4 5 . #1#) (5 . #0#)]

standard input:4:17: In procedure last-pair in expression (append! (quote #) 
(quote #)):
standard input:4:17: Circular structure in position 1: (4 5 . #1#)
ABORT: (misc-error)
guile> 

-- 
David Kastrup





reply via email to

[Prev in Thread] Current Thread [Next in Thread]