lilypond-user
[Top][All Lists]
Advanced

[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 16:13:30 -0500

Hi David,

> Mike is a genius that will reinvent three wheels
> in the time it takes to learn about one.

That might be a little bit of the pot calling the kettle black…?  ;)

> Try the following:
> 
> %%%  SNIPPET BEGINS
> \version "2.19.83"
> 
> some-music = { a'4 bes' b' aes' g' cis' d' ees' fis' f' e' c' }
> 
> #(display (let ((res (music-pitches some-music)))
>          (map ly:pitch-semitones (map ly:pitch-diff (cdr res) res))))
> 
> buzz =
> #(define-scheme-function (mus) (ly:music?)
>  (map number->string
>   (let ((res (music-pitches mus)))
>    (map ly:pitch-semitones (map ly:pitch-diff (cdr res) res)))))
> 
> \markup \right-column \with-color #red { \buzz \some-music }
> 
> %%%  SNIPPET ENDS

Oh! So much to learn in there. Thank you.

Any idea which (if either) is more expensive, yours or Mike’s (well, 
{Mike+David N.}’s)?

> For teaching how to fish from scratch, Mike's demonstration may be 
> better-suited.
> My solution is more a demonstration of what you can do
> when you know your way around the fishing grounds.

There are definitely multiple plateaus in every learning mountain climb…

> I find it great that you understand everything that Mike does here

In fact, I may have sent him down this particular path by suggesting that we do 
essentially what I would do with a list of numbers in maxima:

   diff(nums) := rest(nums,1) - rest(nums,-1)

He probably just took that idea and ran with it to the [Lily-Scheme] goal-line.

> you are well-prepared to figure out what I am doing, and what may
> be hidden away in some of the internals of the read-made tools I use.

What tools are those exactly?

> it is seminal for me to tackle problems with the simplest means I can manage.

I live (and die?) by the belief that "Every elegant question has an elegant 
answer".  =)

Thanks!
Kieren.
________________________________

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




reply via email to

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