Re: [frogs] Guitar capo code in scheme

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]




On 7/21/11 4:45 AM, "Wols Lists" <antlists@xxxxxxxxxxxxxxx> wrote:

> On 21/07/11 06:23, Marc Hohl wrote:
>> Am 20.07.2011 23:18, schrieb Wols Lists:
>>> On 20/07/11 01:05, Carl Sorensen wrote:
>>>> 
>>>> With the exceptions I've noted above, it looks great!  I think this
>>>> will do
>>>> exactly what you want done, and it will satisfy my concerns and Neil's
>>>> concerns.  Great job!
>>>> 
>>> Okay, I've tried to follow what you've said, and make the appropriate
>>> changes. Patches attached. But it won't run :-( and I'm pretty certain
>>> I've messed up the "let(" syntax.
>>> 
>>> I've looked at the scheme tutor "structure and interpretation..." and
>>> while I sort of understand what's going on, I haven't quite got it yet.
>>> 
>>> Anyways, here's the code:
>>> 
>>> (define-public (capo-handler pitches bass inversion context)
>>>    (let (chord-function (ly:context-property context
>>> 'chordNameFunction #f))
>> At a quick glace, I think here is the error:
>> 
>> let must be followed by two parentheses:
>> 
>> (let ((foo ( ... ))
>>         (bar ( ... ))
>> 
>>         ...function calls follow here... ))
>> 
>>>      (capo-pitch (ly:context-property context 'capoPitch #f))
>> And here ends the variable block, add another ")" in the line above.
>> 
>> I didn't test it, though.
>> 
>> HTH,
>> 
>> Marc
> 
> Unfortunately, I think I picked that up :-(
> 
> What I posted was my first draft, which I committed to my git because I
> was reasonably happy. I've actually tried a bunch of variants, but
> seeing as they all blew up with the same error, I didn't bother
> committing them. As far as I can tell, the error is simply saying "I
> can't compile this procedure, there's a problem", which makes my life
> difficult because I can't see what's wrong and the error gives me no
> clues ...
> 
> As I understand the syntax of let - and I know this is not formatted
> "nicely", but to make things clear, it's
> 
> (let
>         ( ;; variable declaration block
>                 (variable value)
>                 (variable value)
>         )
>         (

You can't just glue statements together in a list.  You either have to leave
out the parentheses:

  (statement 1)
  (statement 2)
  (statement 3)) ; end of let block

or you can combine them in a begin block

   (begin
      (statement 1)
      (statement 2)
      (statement 3)); end of begin
); end of let

HTH,

Carl


---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/