Skip to main content
gamedev.net
🔒 Locked

Using eval in Scheme

Started by TheUnbeliever Feb 13, 2007 at 1:41 PM 1 replies 1.3k views
Original Post
TheUnbeliever
TheUnbeliever
I'm working through SICP at the moment, but in a brief diversion looking for something entirely separate, I hit upon eval. My understanding is that, according to the Scheme standard, it should work something like: (eval '(+ 2 2) (scheme-report-environment 5)) or (eval '(+ 2 2) (null-environment 5)) However, typing this into the MIT Scheme interpreter tells me that both scheme-report-environment and null-environment are unbound variables. So, does anyone know what I've misunderstood or am missing?
[TheUnbeliever]
TheUnbeliever
TheUnbeliever
Okay, I actually tried RTF-MIT-M, and discovered that it works with

(eval '(+ 2 2) (the-environment))

Which is fine by me, since according to the Scheme website only a few implementations actually stick to R5RS.
[TheUnbeliever]
aviosity
aviosity
Hey TheUnbeliever,

Great to see someone else using Scheme!

You're correct in that few people are using the proper standard as it is. At my university (Indiana) we use Scheme almost exclusively, and we use Petite Chez Scheme (disclosure - the professor who wrote Chez Scheme is at Indiana). Every Scheme interpreter I've used, I've had to hunt through the documentation because I learned in Petite, but the variable names used are different in every interpreter. Caused a lot of confusion when I tried using Dr. Scheme :-P.

My advice for any Schemer is to RTM before using a new environment, even different versions of the same one, because the only constant I've found is that they're all different. Hope you're finding Scheme fun and rewarding!

Aviosity

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.