[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using Scheme
From: |
Nicolas Sceaux |
Subject: |
Re: Using Scheme |
Date: |
Fri, 12 May 2006 20:37:13 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) |
Mats Bengtsson <address@hidden> writes:
> Trent Johnston wrote:
>
>>Sorry I should have been a bit more specific before...
>>
>>I tried using
>>
>>manBeam = #(define-music-function (parser location beg end) (number?
>>number?)
>> #{ \once \override Beam #'positions = #'($beg . $end) #} )
>>
> Nicolas recently answered a closely related question.
> One solution should be to replace
> #'($beg . $end)
> by
> (cons $beg $end)
To Trent:
You need to understand that a scheme form preceded by a quote (that's
called a quoted form) is not evaluated. Thus, something like
'(var1 . var2) evaluates to that, (var1 . var2), eg a cons cell
containing two symbols, var1 and var2. But what you want is a cons cell
with two numbers, the value of the variables var1 and var2. So you
should not quote the form, so that the variables should be evalutated.
Instead, you make the cons cell using the function `cons':
(cons var1 var2) ==> (3 . 6)
supposing that var1 and var2 respectively evaluate to 3 and 6.
manBeam =
#(define-music-function (parser location beg end)
(number? number?)
#{ \once \override Beam #'positions = #(cons $beg $end) #})
\manBeam #3 #6
or:
manBeam =
#(define-music-function (parser location beg-end)
(cons?)
#{ \once \override Beam #'positions = #$beg-end #})
\manBeam #'(3 . 6)
\manBeam #(cons 3 6)
nicolas
- Using Scheme, Trent Johnston, 2006/05/12
- Re: Using Scheme, Paul Scott, 2006/05/12
- Re: Using Scheme, Paul Scott, 2006/05/12
- Re: Using Scheme, Trent Johnston, 2006/05/12
- Re: Using Scheme, Paul Scott, 2006/05/12
- Re: Using Scheme, Trent Johnston, 2006/05/12
- Re: Using Scheme, Paul Scott, 2006/05/12
- Re: Using Scheme, Trent Johnston, 2006/05/12
- Re: Using Scheme, Mats Bengtsson, 2006/05/12
- Re: Using Scheme,
Nicolas Sceaux <=
- Re: Using Scheme, Graham Percival, 2006/05/13
- Re: Using Scheme, Nicolas Sceaux, 2006/05/13
- Re: Using Scheme, Trent Johnston, 2006/05/14
- Re: Using Scheme, Graham Percival, 2006/05/14
Re: Using Scheme, Graham Percival, 2006/05/12