define-datatype

602 views
Skip to first unread message

Ken

unread,
Oct 9, 2013, 3:31:28 PM10/9/13
to eo...@googlegroups.com
Hi all,

I'm new to Racket, but I wanted to structure a course around EOPL3. I was cruising through the book until I got to p. 46 which has the book's first define-datatype expression.

So, I start up Racket (v5.3.6), type in the code from the text:

#lang eopl

(define-datatype lc-exp lc-exp?
(var-exp
(var identifier?))
(lambda-exp
(bound-var identifier?)
(body lc-exp?))
(app-exp
(rator lc-exp?)
(rand lc-exp?)))

and when I press Run, I get the following error:

identifier?: unbound identifier in module in: identifier?

What am I doing wrong? (And more specifically, is there a standard way I should set things up to most usefully work in EOPL3?)

Thanks,
   Ken

Yukang Chen

unread,
Oct 14, 2013, 4:28:00 PM10/14/13
to eo...@googlegroups.com
Hi Ken,

identifier? is not defined,
usually this is enough:

(define identifier? symbol?)


have more study on define-datatype, this is used very frequently in EOPL.
If you used to it, it will very easy for reading much part of the code.

also you can refer my code for exercises, https://github.com/chenyukang/eopl
where I try to construct every exercises stand-alone.
I use Chicken-scheme.

Ken

unread,
Oct 16, 2013, 3:30:31 PM10/16/13
to eo...@googlegroups.com
Thank you very much! That got things going.

Thanks again,
   Ken
Reply all
Reply to author
Forward
0 new messages