[racket] PLAI Section 1.3, Page 8

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Tue Jan 18 09:41:41 EST 2011

In general, the only reliable code to copy and paste (modulo PDF
issues) is at the end of each chapter. The code in the chapter
implicit relies on all previous code in the chapter (and maybe some
from previous chapters) being present --- except when it doesn't,
because, for example, a function is being redefined and "corrected."


2011/1/18 Kevin Taylor <kevin683 at gmail.com>:
> All,
> I am working through PLAI for self-study. I've gotten to section 1.3, page
> 8. There is an example of parsing code and some example output.
> Unfortunately, clearly num, add, and sub need to be defined for the example
> code to run.
> ;; parse : sexp −→ AE ;; to convert s-expressions into AEs
> (define (parse sexp)
> (cond
> [(number? sexp) (num sexp)]
> [(list? sexp)
> (case (first sexp)
> [(+) (add (parse (second sexp))
> (parse (third sexp)))]
> [(-) (sub (parse (second sexp))
> (parse (third sexp)))])]))
> Since it isn't mentioned in the book at all that num, add, and sub need to
> be defined in order to run the example code, I am getting the impression
> that this book was not intended for self-study. (Explaining that num, add,
> and sub need to be defined and giving some hints as to how is something that
> an instructor would likely cover.) Any thoughts on that before I get further
> into the book?
> Also, are there any pointers that someone on the list can provide for this?
> Either conceptual guidance or pointers to somewhere on the web where I can
> do some prerequisite reading in order to get this parsing code working?
> I don't want to proceed until I have this example code running.
> Cheers and TIA,
> --
> Kevin
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.