[racket] PLAI Section 1.3, Page 8
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110118/7ff23eaf/attachment.html>