Hi Ben, Adding syntax for both applications, user defined functions and adding evaluation of these in the same execise, is a bit much. It is therefore split up into exercise 356, 357, 358 and 359.
Exercise 356 is only about extending the data definition such that applications can be represented. In excercise 357 eval-definition1 receives as one of its argument the function (including the body) of the user defined function. /Jens Axel 2017-07-12 15:41 GMT+02:00 Ben Morin <benand...@gmail.com>: > I've been working my way through HtDP on and off over the past several > months. I've generally been able to figure it out on my own (even if it > takes awhile). However, Intertwined Data has given me a couple problems > that I just can't seem to wrap my head around. > > The major one is 21.3 "Interpreting Functions." > http://www.ccs.neu.edu/home/matthias/HtDP2e/Draft/part_ > four.html#%28counter._%28exercise._ex~3absl-one-def%29%29 > > Exercise 356 asks to extend the data definition of > > ; A BSL-var-expr is one of: > ; – Number > ; – Symbol > ; – (make-add BSL-var-expr BSL-var-expr) > ; – (make-mul BSL-var-expr BSL-var-expr) > > to "include application of a programmer-defined function," which is a > function name and expression, My first thought was something in line with > the rest of the chapter: > > (make-func [name expr]) > > But looking at examples like (k (+ 1 1)) makes it seem like the data > definition should just incorporate a name and an argument. Where does the > function's body come into play? > > Exercise 357 then asks to create a function with the following parameters: > - a BSL-Func-Expr, would this be just (k (+ 1 1))? > - the function name, k? > - the function parameters, (+ 1 1) is the argument? > - the function body, ... (+ 1 1)? > > How can a user-defined function like "k" be evaluated if only its argument > is known? > > I feel like I read this, understand the words, but can't comprehend the > sentences. > > > Thanks in advance > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- Jens Axel Søgaard -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.