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

2020-01-22 Thread David Nalesnik
On Wed, Jan 22, 2020 at 8:26 AM Simon Albrecht wrote: > On 21.01.20 22:05, Kieren MacMillan wrote: > > I’m pretty sure I would have taken quite a while to find my way to > "make-simple-markup" > > > Note that > > (make-simple-markup "foo") > > is equivalent to > > (markup #:simple "foo") > > in o

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

2020-01-22 Thread Simon Albrecht
On 21.01.20 22:05, Kieren MacMillan wrote: I’m pretty sure I would have taken quite a while to find my way to "make-simple-markup" Note that (make-simple-markup "foo") is equivalent to (markup #:simple "foo") in other words it’s the spelled-out version of what’s usually accessed through

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

2020-01-22 Thread Kieren MacMillan
Hi David (N), > Exactly. Even though I took Mike's original more or less as-is and > just added a couple of things, I still got my fair share of errors. > With my memory I *always* end up looking up a few things. Well, that makes me feel a little better… Given the speed, complexity, and complet

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

2020-01-22 Thread David Nalesnik
On Wed, Jan 22, 2020 at 1:33 AM Urs Liska wrote: > > Am Dienstag, den 21.01.2020, 20:11 -0500 schrieb Kieren MacMillan: > > or 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. =( > > I can promise

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

2020-01-22 Thread David Kastrup
Kieren MacMillan writes: > Hi David, > >> I'd use (lambda (d) (format "~@d" d)) here myself > > Good to learn that tool! > >> but it does differ in writing +0 (in case that's undesired). > > It is. > >> If one wants to avoid an unnecessary string-append, one can go >> (lambda (d) (let ((s number-

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

2020-01-22 Thread Kieren MacMillan
Hi Urs, > I can promise you, it will be that way for a very long time. Everyone on this list is so encouraging… ;) > But I can also promise you that at some point (and if you continue at > that pace that may be rather sooner than later) the errors will stop > scaring you and rather point you in

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

2020-01-22 Thread Kieren MacMillan
Hi Aaron, > Instead of string-append and number->string, try (format #f "~@d" d). > > ~d formats an integer as a decimal value > @ includes "+" for positive values > > One caveat is it formats zero as "+0". > > Perhaps: (lambda (d) (if (zero? d) "0" (format #f "~@d" d))) That’s great — tha

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

2020-01-22 Thread Kieren MacMillan
Hi David, > I'd use (lambda (d) (format "~@d" d)) here myself Good to learn that tool! > but it does differ in writing +0 (in case that's undesired). It is. > If one wants to avoid an unnecessary string-append, one can go > (lambda (d) (let ((s number->string d)) > (if (positive?

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

2020-01-22 Thread David Kastrup
Kieren MacMillan writes: > HOLD THE PRESSES!! > > I think I have it: > > SNIPPET BEGINS > \version "2.19.83" > > some-music = { a'4 bes' b' aes' g' cis' d' ees' fis' f' e' c' } > > #(define-markup-list-command (diffints layout props mus) (ly:music?) >(interpret-markup-list layout props

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

2020-01-22 Thread Brian Barker
At 17:03 21/01/2020 -0500, Kieren MacMillan wrote: ... it seemed a wonderfully magical start out of the gate, but we were ultimately unable to take it to the goal-line. Also, I mixed my sporting metaphors in that sentence; oh well. That's nothing: a moment ago we had someone playing football w

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

2020-01-21 Thread Urs Liska
Am Dienstag, den 21.01.2020, 20:11 -0500 schrieb Kieren MacMillan: > or 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. =( I can promise you, it will be that way for a very long time. But I can also p

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

2020-01-21 Thread Aaron Hill
On 2020-01-21 7:02 pm, Kieren MacMillan wrote: HOLD THE PRESSES!! I think I have it: SNIPPET BEGINS \version "2.19.83" some-music = { a'4 bes' b' aes' g' cis' d' ees' fis' f' e' c' } #(define-markup-list-command (diffints layout props mus) (ly:music?) (interpret-markup-list layout pr

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

2020-01-21 Thread Kieren MacMillan
HOLD THE PRESSES!! I think I have it: SNIPPET BEGINS \version "2.19.83" some-music = { a'4 bes' b' aes' g' cis' d' ees' fis' f' e' c' } #(define-markup-list-command (diffints layout props mus) (ly:music?) (interpret-markup-list layout props (map (lambda (d) (string-append (if (pos

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

2020-01-21 Thread Kieren MacMillan
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 figu

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

2020-01-21 Thread David Kastrup
Kieren MacMillan writes: > Hi David, > >> # goes into Scheme, and #{ goes into music mode then. > > Yes, that makes sense in retrospect. > >> If you write #{ then # goes into Scheme and Scheme has no idea what { >> is supposed to be. >> > > And tells you so, in no uncertain terms. ;) Oh, that

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

2020-01-21 Thread Kieren MacMillan
Hi David, > # goes into Scheme, and #{ goes into music mode then. Yes, that makes sense in retrospect. > If you write #{ then # goes into Scheme and Scheme has no idea what { is > supposed to be. And tells you so, in no uncertain terms. ;) > I've not fundamentally changed LilyPond's design.

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

2020-01-21 Thread David Kastrup
Kieren MacMillan writes: > Hi David, > >> Well, ##{ c' d' e' c' #} would work. > > In the "Nearly, But Not Quite There" category: I tried > > #{ c' d' e' c' #} > > which, of course, failed. I didn’t think to prepend a second #. # goes into Scheme, and #{ goes into music mode then. If you writ

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

2020-01-21 Thread Kieren MacMillan
Hi David, > Well, ##{ c' d' e' c' #} would work. In the "Nearly, But Not Quite There" category: I tried #{ c' d' e' c' #} which, of course, failed. I didn’t think to prepend a second #. > Markups are icky things. That is, perhaps, not the best thing to admit to someone on the first rung of

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

2020-01-21 Thread David Kastrup
Thomas Morley writes: > Am Di., 21. Jan. 2020 um 23:13 Uhr schrieb David Kastrup : >> >> Thomas Morley writes: > >> > David, you remember my suggestion to generate that "General Code >> > Reference" with an Index ... ? >> >> Yes, that may have helped. But it may also have delivered a haystack.

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

2020-01-21 Thread David Kastrup
Thomas Morley writes: > Am Di., 21. Jan. 2020 um 23:13 Uhr schrieb David Kastrup : >> >> Thomas Morley writes: > >> > David, you remember my suggestion to generate that "General Code >> > Reference" with an Index ... ? >> >> Yes, that may have helped. But it may also have delivered a haystack.

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

2020-01-21 Thread Thomas Morley
Am Di., 21. Jan. 2020 um 23:13 Uhr schrieb David Kastrup : > > Thomas Morley writes: > > David, you remember my suggestion to generate that "General Code > > Reference" with an Index ... ? > > Yes, that may have helped. But it may also have delivered a haystack. > > I think we probably need a "g

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

2020-01-21 Thread David Kastrup
Kieren MacMillan writes: > Hi David, > >> The line below it is a 2.21.0 feature that cannot be used from a >> LilyPond for which we have an installer. > > Ah. Thanks. (Note: feature/version disconnection is another thing that > caused my past Scheme efforts to stumble, leading to becoming > disco

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

2020-01-21 Thread Kieren MacMillan
Hi David, > The line below it is a 2.21.0 feature that cannot be used from a > LilyPond for which we have an installer. Ah. Thanks. (Note: feature/version disconnection is another thing that caused my past Scheme efforts to stumble, leading to becoming discouraged in my efforts.) > I wasn't aw

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

2020-01-21 Thread David Kastrup
Kieren MacMillan writes: > Hi David, > >> I am glacially slow for almost everything because I am ridiculously >> afraid of wasting time doing something wrong. That turns to work out >> better for teaching than getting anything done myself. > > That may be the best two-sentence description of me

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

2020-01-21 Thread David Kastrup
Thomas Morley writes: > Hi Kieren, hi David, > > Am Di., 21. Jan. 2020 um 22:45 Uhr schrieb David Kastrup : > >> And music-pitches is also convenient to know. > > David, you remember my suggestion to generate that "General Code > Reference" with an Index ... ? Yes, that may have helped. But it

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

2020-01-21 Thread David Kastrup
Kieren MacMillan writes: > Hi David, > >> Of course you can also do >> #(display (let ((res (map ly:pitch-semitones (music-pitches some-music >> (map - (cdr res) res))) >> >> Namely first convert to semitones and then do the difference. > > Ah! Perhaps I was on the right path wit

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

2020-01-21 Thread Kieren MacMillan
Hi David, > I am glacially slow for almost everything because I am ridiculously > afraid of wasting time doing something wrong. That turns to work out > better for teaching than getting anything done myself. That may be the best two-sentence description of me I’ve ever read. =) > And music-pit

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

2020-01-21 Thread Kieren MacMillan
Hi David, > Of course you can also do > #(display (let ((res (map ly:pitch-semitones (music-pitches some-music > (map - (cdr res) res))) > > Namely first convert to semitones and then do the difference. Ah! Perhaps I was on the right path with the first part of what I gave to Mik

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

2020-01-21 Thread Thomas Morley
Hi Kieren, hi David, Am Di., 21. Jan. 2020 um 22:45 Uhr schrieb David Kastrup : > And music-pitches is also convenient to know. David, you remember my suggestion to generate that "General Code Reference" with an Index ... ? Kieren showed me the problem in Salzburg and I suggested quick'n dirty e

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

2020-01-21 Thread David Kastrup
Kieren MacMillan writes: > 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…? ;) I am glacially slow for almost everything because I am ridiculously afraid of wasting ti

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

2020-01-21 Thread David Kastrup
A few annotations: David Kastrup writes: > Kieren MacMillan writes: > >> As the next step, I want to turn this into a function and display the >> result in a markup. Result: I spend several hours searching >> documentation, trying different functions, and getting one (or more!) >> errors per a

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

2020-01-21 Thread Kieren MacMillan
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

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

2020-01-21 Thread Kieren MacMillan
Hi David, > \version "2.19" > > some-music = { a'4 bes' b' aes' g' cis' d' ees' fis' f' e' c' } > > #(define (zip . xss) (apply map list xss)) > > #(define-markup-command (pitch-info layout props args) (ly:music?) > (let* ((res (map >(lambda (foo) (ly:pitch-semitones (ly:music

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

2020-01-21 Thread David Kastrup
Kieren MacMillan writes: > Hi all, > > Here’s a perfect example of why I keep stumbling (and stopping) when trying > to learn Scheme+Lilypond… =\ > > With Mike S’s help — read: he did it all, actually! (though I fully > understand every part of the code) — I have the following: > > %%% SNIPPE

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

2020-01-21 Thread David Nalesnik
Hi Kieren! On Tue, Jan 21, 2020 at 1:52 PM Kieren MacMillan wrote: > > Hi all, > > Here’s a perfect example of why I keep stumbling (and stopping) when trying > to learn Scheme+Lilypond… =\ > > With Mike S’s help — read: he did it all, actually! (though I fully > understand every part of the c