lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function help


From: No Body
Subject: Re: function help
Date: Tue, 21 Jun 2016 14:25:50 -0400

Wow! Works great, thanks Thomas.  I like the second version using the lilypond #{#}   ---- I can easily add markup for font, etc.  Added a string-reverse to get correct order.   I read "extending" several times, skimmed thru "internals", guile manual and R5RS and have been working on this in my spare time for a week --- thanks.

I realize that make-circle-markup is part of lilypond and not Guile, but is there a way I could have known about that and possibly other useful funcs?  I realized from the error messages that I needed markup, but just couldn't figure out how to get it.

Also, is the "#:" in "#:circle" a naming convention or dereferencer or what?  Is there somewhere to look that up?  I don't have much of an understanding about this.

Should I have tried to make this a tinier example?

I wonder why normal fingering doesn't show up in the Tab Staff ...

Thank you, Robby (sorry for even more questions --- the more you know, the more you realize you don't know)

On Tue, Jun 21, 2016 at 3:54 AM, Thomas Morley <address@hidden> wrote:
2016-06-21 6:53 GMT+02:00 No Body <address@hidden>:
> Hello,
> I'm trying to make a fingering function for use with tab that takes a
> string, such as "12345" or "23", breaks it apart and stacks it in a column
> with a circle around each number.  I've commented out part of my feeble
> attempt at a function so that my desired result can be produced with only
> markup. I've read and read and am at the end of my wits. Any help would be
> greatly appreciated! Thanks, Robby
>
> Here's my code:
>
> \version "2.18.2"
>
> % ****** Parts of this are commented out
> fing = #(define-scheme-function
>      (parser location str) (string?)
>
>      ( markup
>          ;#:column
>          ;(map (lambda (c) ( #:circle (string c) ))(string->list str))
>      )
> )

Hi Robby,

two problems with your code:

(1) (map (lambda (c) ( #:circle (string c) ))(string->list str))
#:circle is not a procedure on it's own, so you can't map it over a
list this way.

(2) (markup #:column (map ...))
map returns a list but markup #:column expects a markup-list.

Here two syntax-possibilities to make it work:

\version "2.18.2"

fing =
#(define-scheme-function (parser location str) (string?)
  (make-column-markup
    (map (lambda (n) (make-circle-markup (string n))) (string->list str))))

fing =
#(define-scheme-function (parser location str) (string?)
#{
  \markup
    \column
      #(map (lambda (n) #{ \markup \circle #(string n) #}) (string->list str))
#})

music =
  \relative c' {
    b4\2^\fing "54321" a\3 c\2^\fing "678"  g\3
  }

\new TabStaff \with { \tabFullNotation stringTunings = #banjo-open-g-tuning }
  \music


HTH,
  Harm


reply via email to

[Prev in Thread] Current Thread [Next in Thread]