[Top][All Lists]

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

Re: [Denemo-devel] splitting up (d-GetNotes)

From: Richard Shann
Subject: Re: [Denemo-devel] splitting up (d-GetNotes)
Date: Fri, 24 Jul 2009 16:57:57 +0100

On Fri, 2009-07-24 at 10:28 -0500, Jeremiah Benham wrote:
> I was breaking up (d-GetNotes) like this:
> (define notelist (string-split (d-GetNotes) #\NULL))
> This well except for that fact that a 3 note chord produces a list with
> 4 elements long. I am not sure what the last element is. It does not
> print anything when I try to do something like this with a 3 note chord:
> (display (list-ref notelist 3))
> This will work for me if I only knew what to test to exclude. I was
> processing notelist later like this
> (map process_list notelist) 
> I wanted to put a check in process_list for this. I thought it was null
> but null? and eq? "" did not work. string? returns #t. 

It is "",
if  you test equal? "" returns #t, there are some subtleties about
equality testing, which I haven't re-visited, I just experimented at the
guile prompt:

 (define a "abc\0def\0")
 (define b (string-split a #\NULL))
 (display (equal? (list-ref b 2) ""))


I think you should be returning a space separated set of notes - that would be 
the LilyPond notation (i.e. the contents of < >).
It is going in the other direction that we have a \0 separator convention - 
passing data to C, so that we can pass strings with any characters in them.

> Would it better to truncate the list somehow or rebuild the notes
> with a procedure using string->list?
> Jeremiah  
> _______________________________________________
> Denemo-devel mailing list
> address@hidden

reply via email to

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