​

On Mon, Jun 25, 2018 at 9:02 PM, Aaron Hill <lilyp...@hillvisions.com>
wrote:

> On 2018-06-25 17:25, Freeman Gilmore wrote:
>
>> On Mon, Jun 25, 2018 at 9:29 AM, Urs Liska <li...@openlilylib.org> wrote:
>>>
>>>> Try this file:
>>>>
>>>> \version "2.19.80"
>>>>
>>>> #(let
>>>>   ((something 'something-else))
>>>>   (display something)
>>>>   (newline)
>>>>   (display something)(display something))
>>>>
>>>
>> In you first example #(let...) what function does 'let' preform?
>>
>
> Here is the reference on `let` for Guile:
>
> https://www.gnu.org/software/guile/manual/html_node/Local-Bi
> ndings.html#Local-Bindings
>
> Without repeating verbatim what is there, `let` is a way of defining
> locally-scoped variables.
>
> In the example above, `something` is being defined as `'something-else`,
> and it is being referenced later in the function body several times.  But
> as a local variable, `something` is ephemeral and will no longer be valid
> outside of the scope of the let-block body.  Consider:
>
> %%%%
>   #(let
>     ((a 1) (b 2))
>     (display (+ a b))    #! should output 3 !#
>     (let
>      ((a b) (c 3))
>      (display (+ a c))   #! should output 5 !#
>     )
>     (display a)          #! should output 1 !#
>     #!(display c)!#      #! error: unbound variable c !#
>    )
> %%%%
>
> The inner let here redefines `a` while also defining `c`.  Outside of its
> body, the original value of `a` is effectively restored but then `c` is no
> longer bound so you cannot refer to it.
>
> Hope that helps,
>
> -- Aaron Hill
>

​Thanks Aaron​:
​The example was very clear. Now I am reading the reference next.

Thank you, ƒg

>
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to