> Second, you need to use `let` here, not `define`. See
> 
> https://extending-lilypond.gitlab.io/en/scheme/local-variables.html

BTW, I suggest to cover one more issue with local variables, namely
whether arguments to a function are seen in sub-functions, which are
IMHO a very good addition to `let` and `let*` to write clean and
readable code – often much more readable than anonymous lambda
expressions.

Example:

```
(define (foo bar)
  (define (baz)
    ...
    (if bar)        ; Is 'bar' visible?  If yes, when is 'bar'
      ...           ; expanded?  At the time 'foofoo' is defined?
                    ; At the time 'foofoo' is executed?
```


    Werner

Reply via email to