Well, not sure actually, since it's problematic with 0, 1 , -1.
So how about :
%circled-pattern
#(define-markup-command
(circled-pattern layout props radius angle num arg)
(number? number? number? string?)
(let* ((rep (- (abs num) 1))
(the-form
(if (eq? num 0) (markup "")
(if (eq? (abs num) 1) (markup arg)
(markup
(#:combine
(#:null)
(fold
(lambda (i prev)
(markup
(#:combine
(#:rotate
(* i (/ angle rep))
(#:concat (#:null #:hspace radius arg)))
prev)))
(markup (#:null))
(iota (1+ rep)))))))))
(interpret-markup layout props the-form)))
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
Plus : any idea why 'testTwo does not work ?
Cheers,
Pierre