[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hash/backslash confusion
From: |
Mark Polesky |
Subject: |
hash/backslash confusion |
Date: |
Wed, 12 Aug 2009 23:44:19 -0700 (PDT) |
Would anyone like to take a little time to look over this
highly confusing situation and try to explain to me why it
is this way?
I would find it quite helpful.
Thanks!
- Mark
\version "2.13.4"
% music expression variables can be defined with "=" or scheme-style,
% but all variable names must be entirely alphabetic.
sopranoMusic = \relative c'' { c8 d e d c2 }
#(define altoMusic #{ \relative e' { e8 f g f e2 } #})
% music expression variables can only be dereferenced with "\".
\score {
\new Staff <<
{ \sopranoMusic }
\\
{ \altoMusic }
>>
}
% numeric variables can be defined with "=" or scheme-style, and
% scheme-defined numeric variable names *can* have non-alphabetic
% characters.
one = 1
hashTwo = #2
#(define scm-5 5)
% string variables can be defined with "=" or scheme-style, and
% scheme-defined string variable names can have hyphens, but not
% numbers!
quoteThree = "3"
hashQuoteFour = #"4"
#(define scm-quote-Six "6")
% regardless of the definition method, string variables can only be
% dereferenced with "\"; and numeric variables can only be dereferenced
% with "#"!
\markup \concat {
\number \quoteThree % string
\hspace #one % number
\number \hashQuoteFour % string
\hspace #hashTwo % number
\number \scm-quote-Six % string
\hspace #scm-5 % number
\number \hashQuoteFour % string
}
%% of course, these restrictions are not an issue within scheme code
#(for-each
display
(list one hashTwo quoteThree hashQuoteFour scm-5 scm-quote-Six))
%% now, neither of these will work
% \markup \concat { #3 #4 #6 }
% \markup \concat { #"3" #"4" #"6" }
%% but this will
\markup \concat { 3 4 6 }
%% and of course this will work
\markup \concat { "3" "4" "6" }
%% but strangely so will this
%% (note that \hashQuoteFour works, but not #"4")
\markup \concat { \quoteThree \hashQuoteFour \scm-quote-Six }
%% so these numbers must be internally represented as strings?
%% (since this does work)
\markup \concat { 3 4 6 }
%% there seems to be no way to successfully pass any of these to \markup
% \markup \concat { #one #hashTwo #scm-5 }
% So much confusion... any explanations appreciated!