lilypond-devel
[Top][All Lists]
Advanced

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

Re: input/regression/scheme-text-spanner.ly: fix problem with constants


From: david . nalesnik
Subject: Re: input/regression/scheme-text-spanner.ly: fix problem with constants (issue 11614044)
Date: Wed, 24 Jul 2013 15:11:01 +0000

> Instead, complete-grob-entry (or whatever it was
> called)
> needs to be changed in order to work non-destructively.  It does not
> make sense to do this separately from the original code.

OK, I won't bother yet with add-grob-definition here, but I wonder: if I
use copy-tree on a literal expression, is it alright to modify the
resulting list with assoc-set! and the like?  In other words, does
copying the list create another literal that I should again refrain from
tampering with?

I ask because the following attempt at avoidance looks like overkill to
me:

#(define (add-grob-definition grob-name grob-entry)
   (let* ((meta (assoc 'meta grob-entry))
          (meta-entry (cdr meta))
          (class (assoc-get 'class meta-entry))
          (ifaces (assoc 'interfaces meta-entry))
          (ifaces-entry (cdr ifaces))
          (ifaces-entry (append (case class
                                  ((Item) '(item-interface))
                                  ((Spanner) '(spanner-interface))
                                  ((Paper_column) '((item-interface

paper-column-interface)))
                                  ((System) '((system-interface
                                               spanner-interface)))
                                  (else '(unknown-interface)))
                                 ifaces-entry))
          (ifaces-entry (uniq-list (sort ifaces-entry symbol<?)))
          (ifaces-entry (cons 'grob-interface ifaces-entry))
          (ifaces (cons (car ifaces) ifaces-entry))
          (meta-entry (acons 'name grob-name meta-entry))
          (meta-entry
            (map (lambda (x)
                   (if (eq? (car x) 'interfaces) ifaces x))
                 meta-entry))
          (meta (cons (car meta) meta-entry))
          (grob-entry
            (map (lambda (x)
                   (if (eq? (car x) 'meta) meta x))
                  grob-entry)))

     (set-object-property! grob-name 'translation-type? list?)
     (set-object-property! grob-name 'is-grob? #t)

     (set! all-grob-descriptions
           (cons (cons grob-name grob-entry)
                 all-grob-descriptions))))



Thanks for your patience!
David


https://codereview.appspot.com/11614044/



reply via email to

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