[racket] htdp: functions of section 19 violate the grammar of section 8

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Wed Sep 10 14:25:42 EDT 2014

I believe it's answered in a subsequent paragraph?

"The abstract functions of section 19 violate Scheme's basic grammar
in two ways. First, the names of functions and primitive operations
are used as arguments in applications. An argument, though, is an
expression, and the class of expressions does not contain primitive
operations and function names. It does contain variables, but we
agreed that they are only those variables mentioned in variable
definitions and as function parameters. Second, parameters are used as
if they were functions, that is, the first position of applications.
But the grammar of section 8 allows only the names of functions and
primitive operations in this place."

On Wed, Sep 10, 2014 at 1:02 PM, Daniel Bastos <dbastos at toledo.com> wrote:
> I have not been able to verify this statement.
>
>   "As a matter of fact, the functions of section 19 violate the Scheme
> grammar of section 8." -- First paragraph of section 20.
>
> I think the statement is referring to functions such as filter1.
>
> (define (filter1 rel-op alon t)
>   (cond
>     [(empty? alon) empty]
>     [else (cond
>    [(rel-op (first alon) t)
>     (cons (first alon)
>           (filter1 rel-op (rest alon) t))]
>    [else
>     (filter1 rel-op (rest alon) t)])]))
>
> It must be because of rel-op, I figure. But rel-op is a <var>.
> According to Figure 21 (the grammar of section 8), (<var> <exp>
> ...<exp>) is an <exp>, so I think filter1 doesn't violate the grammar
> of section 8.
>
> Where am I wrong? Thank you!
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.