lilypond-user
[Top][All Lists]
Advanced

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

Re: if procedure


From: Freeman Gilmore
Subject: Re: if procedure
Date: Wed, 27 Nov 2019 13:43:45 -0500

On Wed, Nov 27, 2019 at 10:32 AM Anders Eriksson <address@hidden> wrote:
>
>
> On 2019-11-27 14:20, Freeman Gilmore wrote:
>
> From Extending Lilypond:
>
> guile> (define a 3)
> guile> (define b 5)
> guile> (if (> a b) "a is greater than b" "a is not greater than b")
> "a is not greater than b"
>
> Note missing ")".
>
> No, it's not missing any ")"
>
> In Frescobaldi i tried:
>
> \version "2.19.83"
> #(define a 3)
> #(define b 5)
> #(display (if (> a b) "a is greater than b" "a is not greater than b")
> "a is not greater than b"))
>
>
> What is the code suppose to do?
> You define two variables, a and b, and give them a value.
> You then compare a and b and if a is greater than b then you write out a text 
> "a is greater than b" if not then you write out a different text "a is not 
> greater than b".
>
> Scheme is a Lisp based language and uses parentheses to group statements.
> The number of left parentheses should be the same as the number of right 
> parentheses!!!
>
> Your problem is the line
>
> #(display (if (> a b) "a is greater than b" "a is not greater than b")
>
> It has 3 left parentheses and 2 right parentheses.
> Frescobaldi is helpful and shows the matched parentheses when you put the 
> cursor on a a parentheses.
> Using this help you soon will find the the first left parentheses has no 
> right parentheses.
>
> The error will disappear if you add a right parentheses last on the line
> #(display (if (> a b) "a is greater than b" "a is not greater than b"))
>
> // Anders
That got it, i was reading the book wrong; i  was trying to include
the results as one of the choices.   I do not see the ")" in the book
but it does copy and past it ok.   Probably have the print to large.
Al is well.

Thank you,
fg



reply via email to

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