[racket] htdp: functions of section 19 violate the grammar of section 8
The arguments are the <exp> ...<exp>. The function position is <var> or <prm>
Essentially, the grammar in sec20 extends sec8 with the ability to:
- pass functions and primitives, like +, as arguments, and
- compute the applied function in the function position instead of
always using predefined <var>s or <prm>s
Does that make sense?
On Wed, Sep 10, 2014 at 2:57 PM, Daniel Bastos <dbastos at toledo.com> wrote:
> I remember having had that question when I was at that chapter. I must
> have thought I answered it, but I'm having it again and unable to
> answer now. IOW, I'm confused.
>
> I'm having difficulties with this phrase too. "First, the names of
> functions and primitive operations are used as arguments in
> applications."
>
> What is an argument in application? I'm going to try to answer it. An
> application is, according to the grammar of section 8,
>
> (<var> <exp> ...<exp>)
>
> or
>
> (<prm> <exp> ...<exp>)
>
> So its arguments are <var>, <exp>, ... and the final <exp>. Similarly,
> the second application has arguments <prm>, <exp>, ..., <exp>. Is that
> correct?
>
> Thank you.
>
> On Wed, Sep 10, 2014 at 3:25 PM, Stephen Chang <stchang at ccs.neu.edu> wrote:
>> 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."