lilypond-user
[Top][All Lists]
Advanced

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

Re: function help


From: Thomas Morley
Subject: Re: function help
Date: Tue, 21 Jun 2016 09:54:47 +0200

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]