> 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/ _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel