lilypond-user
[Top][All Lists]
Advanced

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

Re: scm: (apply and …) and alist problem


From: Urs Liska
Subject: Re: scm: (apply and …) and alist problem
Date: Tue, 14 Apr 2015 00:38:35 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.6.0



Am 14.04.2015 um 00:10 schrieb Simon Albrecht:
1) Why can’t ‘apply’ be used with ‘and’ (defined-all.ly example file)?
2) Why does assoc-get return #f instead of a list in the second example file?

Help is much appreciated.

Yours, Simon

I think 'and' is not a 'proc' in the sense of what 'apply' accepts.
But this doesn't matter because what you need is much simpler:

\version "2.19.17"

#(define (defined-all? . l)
   (every defined? l))
  
sc = foo
ac = bar

#(display (defined-all? 'sc 'ac))

Actually this is so simple that I don't know if it is even necessary to define a procedure for that (depends on the context of course):

#(display (every defined? 'sc 'ac))

\version "2.19.17"

% would be placed in the actual music file
clef-set = low

#(define high-clefs '("G" "mezzosoprano" "C" "varbaritone"))
#(define low-clefs '("soprano" "C" "tenor" "F"))
#(define modern-clefs '("G" "G" "G_8" "F"))
#(define clef-set-alist `((high . ,high-clefs)
                    (low . ,low-clefs)
                    (modern . ,modern-clefs)))

% test a bit from define-scheme-function
#(display (assoc-get clef-set clef-set-alist))

You should define clef-set like
clef-set = #'low
or
#(define clef-set 'low)
to make it a real symbol.

HTH
Urs


reply via email to

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