[Top][All Lists]

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

Re: [Scheme coding] turning a list into a markup/string

From: Kieren MacMillan
Subject: Re: [Scheme coding] turning a list into a markup/string
Date: Tue, 21 Jan 2020 20:11:11 -0500

Hi again (too soon?),

I’m trying to make the positive intervals have a + in front of them.

Q1. My intuition tells me I need to use a lambda function with append. Does 
that seem like a reasonable approach?

Regardless, assume for argument’s sake that it is… For the life of me, I can’t 
quite figure out where exactly such a construct would appear in the code. 
Everywhere I try throws [different] errors. =(

The following doesn’t throw an error, and I know why, and I know why it outputs 
what it does — so I’m not quite as stupid as I feel (and maybe appear?):

\version "2.19.83"
some-music = { a'4 bes' b' aes' g' cis' d' ees' fis' f' e' c' }
     ((lambda (d) (append d d))
      (map number->string
        (let ((muspst (map ly:pitch-semitones (music-pitches some-music))))
          (map - (cdr muspst) muspst)))))

So this leads to my real question:

Q2. What is a good way to change

  (map number->string
    (let ((muspst (map ly:pitch-semitones (music-pitches some-music))))
      (map - (cdr muspst) muspst))))

so that it outputs

    (+1 +1 -3 -1 -6 +1 +1 +3 -1 -1 -4)



Kieren MacMillan, composer (he/him/his)
‣ website:
‣ email: address@hidden

reply via email to

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