Re: [PATCH] Move ambitus print callback to scheme
Le 29 août 09 à 06:56, David Kastrup a écrit : Carl Sorensen c_soren...@byu.edu writes: On Aug 28, 2009, at 1:16 PM, Nicolas Sceaux nicolas.sce...@free.fr 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. You're right on both points! thanks. ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [PATCH] Move ambitus print callback to scheme
On 8/28/09 10:56 PM, David Kastrup d...@gnu.org wrote: Carl Sorensen c_soren...@byu.edu writes: On Aug 28, 2009, at 1:16 PM, Nicolas Sceaux nicolas.sce...@free.fr 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. It is *not* a literal list. Here is the proof: guile (define a '(4 5)) guile (define b '(4 5)) guile (eq? a b) #f guile (define c '()) guile (define d '()) guile (eq? c d) #t '(4 5) is a literal list, and thus a is not eq? to b, although it is equal? to b On the other hand, c is eq? to d, because '() is a constant, and both c and d are set to the same constant. Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [PATCH] Move ambitus print callback to scheme
Carl Sorensen c_soren...@byu.edu writes: On 8/28/09 10:56 PM, David Kastrup d...@gnu.org wrote: Carl Sorensen c_soren...@byu.edu writes: On Aug 28, 2009, at 1:16 PM, Nicolas Sceaux nicolas.sce...@free.fr 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. It is *not* a literal list. Here is the proof: guile (define a '(4 5)) guile (define b '(4 5)) guile (eq? a b) #f guile (define c '()) guile (define d '()) guile (eq? c d) #t '(4 5) is a literal list, and thus a is not eq? to b, although it is equal? to b Huh? What kind of argument is that supposed to be? (define a 4) (define b 4) (eq? a b) Would you claim that 4 is not a literal integer? '() is literal (namely explicitly specified) and it is a list (namely a cons or nil). '() is not a literal _cons_, and it is not unique. But it certainly is literal (a spelled out value) and a list. On the other hand, c is eq? to d, because '() is a constant, and both c and d are set to the same constant. I think you are just confused about the meaning of literal. -- David Kastrup ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [PATCH] Move ambitus print callback to scheme
Le 27 août 09 à 22:38, Neil Puttock a écrit : 2009/8/26 Carl Sorensen c_soren...@byu.edu: The patch looks good to me. Cheers. You code the empty list as (list). I typically code the empty list as '(). It there a preference? I suspect that we ought to be consistent, although it's not highly important. It could be part of the code janitor work, though. It's just something I noticed in a few places internally (these all seem to be changes made by Nicolas) and thought it was clearer, though admittedly I haven't been particularly consistent when deciding between the two forms. :) 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!) However, guile does not report modifying a literal list as an error, and actually modifies it, so this is somewhat rhetorical. nicolas ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [PATCH] Move ambitus print callback to scheme
On Aug 28, 2009, at 1:16 PM, Nicolas Sceaux nicolas.sce...@free.fr 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. However, guile does not report modifying a literal list as an error, and actually modifies it, so this is somewhat rhetorical. Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [PATCH] Move ambitus print callback to scheme
Carl Sorensen c_soren...@byu.edu writes: On Aug 28, 2009, at 1:16 PM, Nicolas Sceaux nicolas.sce...@free.fr 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 ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [PATCH] Move ambitus print callback to scheme
2009/8/26 Carl Sorensen c_soren...@byu.edu: The patch looks good to me. Cheers. You code the empty list as (list). I typically code the empty list as '(). It there a preference? I suspect that we ought to be consistent, although it's not highly important. It could be part of the code janitor work, though. It's just something I noticed in a few places internally (these all seem to be changes made by Nicolas) and thought it was clearer, though admittedly I haven't been particularly consistent when deciding between the two forms. :) Regards, Neil ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [PATCH] Move ambitus print callback to scheme
On 8/25/09 2:28 PM, Neil Puttock n.putt...@gmail.com wrote: Hi, I've just posted a revised patchset which deals with Han-Wen's comments. http://codereview.appspot.com/110047/show The patch looks good to me. I have a question about style, though. You code the empty list as (list). I typically code the empty list as '(). It there a preference? I suspect that we ought to be consistent, although it's not highly important. It could be part of the code janitor work, though. Thanks, Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [PATCH] Move ambitus print callback to scheme
'() is preferred, as it evaluates to a constant. (list) is a function call, which might mean different things if you override the definition of list. On Wed, Aug 26, 2009 at 5:43 PM, Carl Sorensenc_soren...@byu.edu wrote: You code the empty list as (list). I typically code the empty list as '(). It there a preference? I suspect that we ought to be consistent, although it's not highly important. It could be part of the code janitor work, though. -- Han-Wen Nienhuys - han...@xs4all.nl - http://www.xs4all.nl/~hanwen ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [PATCH] Move ambitus print callback to scheme
Hi, I've just posted a revised patchset which deals with Han-Wen's comments. http://codereview.appspot.com/110047/show Thanks, Neil ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel