Urs Liska <li...@openlilylib.org> writes: > Am 20.06.2018 um 11:38 schrieb David Kastrup: > >> #(define-macro (define-my-custom-function . body) >> `(define-music-function (mus) (ly:music?) >> (let* >> ((elts (ly:music-property mus 'elements)) >> (cnt (length elts))) >> ,@body >> mus))) >> >> That's what one would call a pretty unhygienic macro since it messes >> with a number of symbols/identifiers not specified by the user. > > Hm, valid point. But I think it is worth it given the use case (I will > experiment and keep your point in mind, though).
By the way, you'll probably arrive at something like #(define-macro (define-my-custom-function maybe-doc . body) `(define-music-function (mus) (ly:music?) ,(if (string? maybe-doc) maybe-doc "define-my-custom-function was here") (let* ((elts ... ,@(if (string? maybe-doc) body (cons maybe-doc body))) in order to let the user potentially specify a doc string. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user