Jump to content
  • Advertisement
Sign in to follow this  
TheUnbeliever

Using eval in Scheme

This topic is 4147 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!