2

I'm trying to implement some of SICP graphic programs in Racket, but there are 2 problems:

When I need to use 'let' I can't use beginner language. When I try to change language, or open new file while using "advanced" language, I get this error:

module: identifier already imported from a different source

error when I try to load image module by (require 2htdp/image).

What's going on? Also, are there better ways to train with images in Scheme?

1
  • 2
    Consider not using student languages anymore (I know you are using 2htdp, but #lang racket and others just open the door to much more)
    – ಠ_ಠ
    Aug 22, 2013 at 12:25

2 Answers 2

6

It's not clear why you want to use 2htdp/image in the first place. A much more useful package to use would be Neil Van Dyke's SICP Support page, it provides a language with support for the book and includes the graphical language. That should be enough to solve both of your problems.

2
  • 2
    Tried that... I get "tcp-connect : forbiden client access to planet.racket-lang.org:80 Aug 23, 2013 at 18:47
  • There's a problem with your network, check with the system administrator... or try connecting elsewhere Aug 23, 2013 at 18:52
0

As Óscar mentions, you are better off with using #lang planet neil/sicp, However, if you want to import somethng that exports identical symbols you can prefix them:

(require (prefix-in hi: 2htdp/image))

Then all exported from that have prefix hi:, eg. (hi:circle 30 "outline" "red"). The colon isn't anything special. The prefix could have been xxx and it would be xxxcircle.

Also, you can only import the symbols you want:

; you only want circle and eclipse
(require (only-in 2htdp/image circle ellipse)) 

Or you can import everything except some symbols:

; everything except circle and ellipse
(require (except-in 2htdp/image circle)) 

And there is no reason not using racket or racket/base as language when you know this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.