lilypond-user
[Top][All Lists]
Advanced

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

Re: if procedure


From: Anders Eriksson
Subject: Re: if procedure
Date: Wed, 27 Nov 2019 16:27:08 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1


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

reply via email to

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