[plt-scheme] possible typo in reference?

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Tue Oct 6 23:16:14 EDT 2009

OK, I think I get it. The docs could have said

C[(- 4 (+ 1 1))] -> C[(- 4 []][(+ 1 1)]

and since C[(- 4 [])] is different from C, (+ 1 1) is not in tail
position with respect to the original expression.

In contrast, in the next example

C[(if (zero? 0) (+ 1 1) 3)] -> C[(if #t (+ 1 1) 3)] -> C[(+ 1 1)]

the C for the if-statement and the C for the (+ 1 1) are identical, so
(+ 1 1) is in tail position with respect to the if-statement.

Going back to John's holes, if expr1 can be used to fill the hole in
the larger computation that its containing expression expr2 is meant
to fill, then expr1 is in tail position with respect to expr2. Which
is, I think, just a restatement of the definition without the rigor.

Thanks!

On Tue, Oct 6, 2009 at 10:46 PM, John Clements
<clements at brinckerhoff.org> wrote:
>
> On Oct 6, 2009, at 6:07 PM, Todd O'Bryan wrote:
>
>> I'm reading through the Evaluation Model of the Reference and think I
>> found a typo...
>>
>> ----
>> Section 1.1.2 Tail Position
>>
>> For example, the (+ 1 1) expression is not in tail position with
>> respect to (- 4 (+ 1 1)). To illustrate, we use the notation C[expr]
>> to mean the expression that is produced by substituting expr in place
>> of [] in the continuation C:
>>
>>  C[(- 4 (+ 1 1))] → C[(- 4 2)]
>>
>> In this case, the continuation for reducing (+ 1 1) is C[(+ 4 [])], not
>> just C.
>> ----
>>
>> Should the last sentence say, "In this case, the continuation for
>> reducing (+ 1 1) is C[(+ 4 [])], not just C[(+ 1 1)]." or am I still
>> not understanding this?
>
> The text is correct as written (though there seem to be some pluses and
> minuses changing back and forth).
>
> A continuation (or context) here is something with a hole.  If you plug
> something without a hole into the hole (as in C[(+ 1 1)]), then that is no
> longer a context; it's just a plain old expression. If you plug something
> with a hole in it into the hole (as in C[(+ 4 [])], you get another context.
>  So C is a context, and C[(+ 4 [])] is a context, but C[(+ 1 1)] is not a
> context.
>
> For my word "context," I'm guessing that you'll want to use "continuation."
>
> John
>
>
>
>
>
>


Posted on the users mailing list.