Gianmaria Lari <gianmarial...@gmail.com> writes: > Ciao Harm, Andrew, Aaron and David, > > this is what I have been able to do adapting Harm code: > > \version "2.21.0" > foo = > #(let ((x '(1))) > (define-scheme-function (arg)(symbol?) > (case arg > ((incNumber) (set! x (append (drop-right x 1) (list (1+ (last x)))))) > ((unindent) (drop-right! x 1)) > ((indent) (append! x '(1))) > ((reset) (set! x '(1)))) > (object->string x)))
Harm did not accidentally write (let ((x (cons 1 0))) ... here. '(1) is a _constant_ list where you guarantee to the Scheme interpreter that you will not modify any cons cell of the list and it can place it in read-only memory. If now the next call is 'indent , this guarantee is violated, possibly leading to crashes and inconsistencies in shared constants. Then you use append! and drop-right! for list manipulation and rely on their side effects to do what you want. Those side effects are optional. This is rather bad Scheme code. What are the goals you intend to achieve with those changes? -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user