Hi Orm, I've already add a snippet here: http://lsr.di.unimi.it/LSR/Item?id=1068 May I change the code with the 2nd version? Cheers, Pierre
2018-07-07 19:11 GMT+02:00 Orm Finnendahl < orm.finnend...@selma.hfmdk-frankfurt.de>: > Hi Pierre, Sylvius, > > I did some tests to get a better understanding of lilypond's handling > of markup. Below is an even more condensed version and also an > iterative solution in comparison for anybody interested in scheme > programming: Both functions should create the same result; the first > is somewhat more sexy not needing (re)assignment, but the second > version might be easier to understand for people not familiar with > functional expressions like "fold". > > Sorry for the continued noise, but I thought I'd post it in case it is > helpful for somebody on the list. > > -- > Orm > > %circled-pattern > #(define-markup-command > (circled-pattern layout props radius angle num arg) > (number? number? number? markup?) > (interpret-markup layout props > (let ((rep (abs num))) > (cond > ((= num 0) (markup "")) > ((= num 1) arg) > (#t (fold > (lambda (i prev) > (markup > (#:combine > (#:rotate > (* i (/ angle rep)) > (#:concat (#:null #:hspace radius arg))) > prev))) > (markup (#:null)) > (iota (1+ rep)))))))) > > #(define-markup-command > (circled-pattern-iterative layout props radius angle num arg) > (number? number? number? markup?) > (interpret-markup layout props > (let ((rep (abs num))) > (cond > ((= num 0) (markup "")) > ((= num 1) arg) > (#t (do ((i 0 (1+ i)) > (res (markup (#:null)) > (markup > (#:combine > (#:rotate > (* i (/ angle rep)) > (#:concat (#:null #:hspace radius arg))) > res)))) > ((= i (1+ rep)) res))))))) > > > testOne = \markup "." > testTwo = \markup { "!" } > > \markup\circled-pattern-iterative #5 #180 #15 \testOne > \markup\circled-pattern #5 #-180 #15 \testOne > \markup\circled-pattern #5 #180 #2 \testOne > \markup\circled-pattern #5 #180 #1 \testOne > \markup\circled-pattern #5 #180 #0 \testOne > > \markup\circled-pattern #5 #180 #6 \testTwo > > > Am Samstag, den 07. Juli 2018 um 17:45:58 Uhr (+0200) schrieb sylvius: > > This is brilliant! > > > > Thanks to all for the various solutions! > > > > > On 7. Jul 2018, at 16:18, Pierre Perol-Schneider < > pierre.schneider.pa...@gmail.com> wrote: > > > > > > But of course !! Thanks very much Orm ! > > > Cheers, > > > Pierre > > > > > > 2018-07-07 16:15 GMT+02:00 Orm Finnendahl <orm.finnendahl@selma.hfmdk- > frankfurt.de>: > > > Hi Pierre, > > > > > > Am Samstag, den 07. Juli 2018 um 15:54:41 Uhr (+0200) schrieb Pierre > > > Perol-Schneider: > > > > Plus : any idea why 'testTwo does not work ? > > > > > > because the argument type of "arg" was string?. Below is the updated > > > version: > > > > > > -- > > > Orm > > > > > > > > > %circled-pattern > > > #(define-markup-command > > > (circled-pattern layout props radius angle num arg) > > > (number? number? number? markup?) > > > (interpret-markup layout props > > > (let ((rep (abs num))) > > > (cond > > > ((= num 0) (markup "")) > > > ((= num 1) (markup arg)) > > > (#t (markup > > > (#:combine > > > (#:null) > > > (fold > > > (lambda (i prev) > > > (markup > > > (#:combine > > > (#:rotate > > > (* i (/ angle rep)) > > > (#:concat (#:null #:hspace radius arg))) > > > prev))) > > > (markup (#:null)) > > > (iota (1+ rep)))))))))) > > > > > > testOne = \markup "." > > > testTwo = \markup { \rotate #45 "!" } > > > > > > \markup\circled-pattern #5 #180 #15 \testOne > > > \markup\circled-pattern #5 #-180 #15 \testOne > > > \markup\circled-pattern #5 #180 #2 \testOne > > > \markup\circled-pattern #5 #180 #1 \testOne > > > \markup\circled-pattern #5 #180 #0 \testOne > > > > > > \markup\circled-pattern #5 #360 #5 \testTwo > > > > > > > > > _______________________________________________ > > > lilypond-user mailing list > > > lilypond-user@gnu.org > > > https://lists.gnu.org/mailman/listinfo/lilypond-user > > > > > > _______________________________________________ > > lilypond-user mailing list > > lilypond-user@gnu.org > > https://lists.gnu.org/mailman/listinfo/lilypond-user >
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user