[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Somehow I have got this "thunk" thing wrong.
From: |
Olivier Dion |
Subject: |
Re: Somehow I have got this "thunk" thing wrong. |
Date: |
Sat, 06 Mar 2021 12:16:44 -0500 |
On Sat, 06 Mar 2021, Taylan Kammer <taylan.kammer@gmail.com> wrote:
> On 06.03.2021 01:31, Olivier Dion via General Guile related discussions
> wrote:
>> You've quoted the whole s-exp. Which means lambda is never applied.
>> You have to apply lambda in order to create a procedure.
>
> Just a bit of pedantry on the terms: 'lambda' is not "applied" anyway,
> because it's a special form and not a procedure.
>
> The term "apply" is used when referring to procedures. E.g. you would
> apply 'list', 'cons', 'vector-ref' and so on, but you wouldn't apply
> 'lambda', 'if', 'define' and so on.
>
> In other words, if you can pass it as an argument to 'apply', you can
> "apply" it. E.g. '(apply lambda (list ...))' is invalid syntax.
>
> I think the term "evaluate" would be preferred here, as in: "the
> 'lambda' is quoted so it won't be evaluated."
You're totally right! Lambda is evaluated to a closure. The latter is
then applied to evaluate its expressions in the captured environment.
The following video explains the metacircular evaluator in great
details! Highly recommend all other lectures as well :-)
<https://www.youtube.com/watch?v=aAlR3cezPJg&t=743s>
>
> - Taylan
--
Olivier Dion
PolyMtl