2012/7/8 David Kastrup <d...@gnu.org>: > Thomas Morley <thomasmorle...@googlemail.com> writes: > >> Seems I have to extend my scheme-vocabulary. >> I didn't know/remember `append-map' and `string-concatenate'. > > Picked them from the Guile manuals.
I know. I tend to define my own helpers if I don't find sth useful in the guile-manual in a short amount of time. Should invest more time in looking through the manual. Defining my own helpers is a nice exercise, but ... > >> I really have to learn more of the predefined guile-procedures. >> >>>> (new-args (list-join args-rev " ")) >>> >>> list-join? >> >> I wanted to insert " " between every element of new-args. Otherwise >> there will be no space between the words of p.e. \markup \char-space >> #1 { This little text } >> list-join seems to be a nice function to do so. Anything problematic >> with it? > > I did not find it in the Guile documentation and did not think of > looking in scm/lily-library.scm instead. Looks suboptimal: an > unnecessary test inside of the loop. > > Better is likely > > (define-public (list-join lst intermediate) > (if (null? lst) lst > (cons (car lst) > (append-map! > (lambda (elem) (list intermediate elem)) > (cdr lst))))) > > Or even > > (define-public (list-join lst intermediate) > (if (null? lst) lst > (cons (car lst) > (concatenate! > (zip (circular-list intermediate) (cdr lst)))))) > > The last version is probably fastest since it avoids any user-defined > function in the loop. Could be integrated in the intended patch. > >>>> (ly:stencil-combine-at-edge >>>> (ly:stencil-combine-at-edge >>>> (ly:make-stencil "" >>>> (cons 0 (abs (* pos-nmbr 3 (if (number? word-space-left) >>>> word-space-left word-space)))) >>> >>> word-space-left has been given a default in the function definition. So >>> if it is not a number, this is an error case I would not try to catch. >> >> Do you mean writing >> >> (ly:stencil-combine-at-edge >> (ly:stencil-combine-at-edge >> (ly:make-stencil "" >> (cons 0 (abs (* pos-nmbr 3 (if word-space-left >> word-space-left word-space)))) >> >> instead? > > No. > > (ly:stencil-combine-at-edge > (ly:stencil-combine-at-edge > (ly:make-stencil "" > (cons 0 (abs (* pos-nmbr 3 word-space-left)))))) > > word-space-left has no business being anything but a number. Well, then I don't understand what you want me to do. Intended is the behaviour that the space to the left and to the right of \char-space #<nmbr> {<args> } is increased if nmbr is positive. Additional I want to offer the possibility to add more space in three different ways (if the user wants): only to the left only to the right on both sides using \override #'(word-space-left . 2) etc. I don't see how this could be achieved with your proposal. -Harm _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel