lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme question: convert a range


From: David Nalesnik
Subject: Re: Scheme question: convert a range
Date: Tue, 17 Nov 2015 07:01:27 -0600

Jacques,

On Tue, Nov 17, 2015 at 6:32 AM, Jacques Menu <address@hidden> wrote:
Message says that #(string-append… is not a markup.

> Le 17 nov. 2015 à 13:31, Jacques Menu <address@hidden> a écrit :
>
> Hello folks,
>
> I’ve tried to integrate such a pure Scheme function:
>
>
> guile> (define (function arg)
>   (if (and (integer? (car arg)) (integer? (cdr arg)))
>       (iota (1+ (interval-length arg)) (car arg) 1)
>       )
>   )
> guile> (function '(3 . 7))
> (3 4 5 6 7)
>
>
> as part of a markup, but to no avail. Here is one of my attempts:
>
>
> \version "2.19.30"
>
> #(define (function arg)
>   (if (and (integer? (car arg)) (integer? (cdr arg)))
>       (iota (1+ (interval-length arg)) (car arg) 1)
>       )
>   )
>
> {
>  c'1 -\markup {
>    \column {
>      \column {
>        #(string-append
>          "commllen = " (list->sting (map #'number->string (function '(3 . 7))))
>          )
>      }
>    }
>  }
> }
>
>
> Thanks for your help!
>
> JM

Why not:
{
  c'1 -\markup {
    \column {
      \column {
        #(string-append
          "commllen = "
          (format #f "~a" (function '(3 . 7)))
          )
      }
    }
  }
}


Regarding your approach:

First, it's "list->string" and that deals with a list of character data, not strings.

You could do something like:

{
  c'1 -\markup {
    \column {
      \column {
        #(string-append
          "commllen = "
          (apply string-append (map number->string (function '(3 . 7))))
          )
      }
    }
  }
}

But I'm guessing that's not the output format you want.

Hope this helps,
DN
 


reply via email to

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