2
votes

I was trying to follow how to do scheme and sicp from Which lang packet is proper for SICP in Dr.Racket?

but when I run code in the accepted answer

#lang sicp

(paint-highres  (below (beside diagonal-shading
                         (rotate90 diagonal-shading))
                 (beside (rotate270 diagonal-shading)
                         (rotate180 diagonal-shading))))

I get error

 paint-hires: unbound identifier in: paint-hires

Dr.Racket running scheme - paint error

I have installed the sicp package. Anyone know what the problem is?

2
We need some more info. Which scheme implementation did you chose? How did you run code? What that code is? - rsm
I googled and found aduni.org/courses/sicp/courseware/psets/Problem_Set_04_hend.scm which says that paint-hi-res/paint-hires is now simply paint. I also looked at sicp-lang implementation and the current one doesn't have paint-hi-res, so I think the docs is simply outdated. - Sorawee Porncharoenwase
@rsm did you read the link? When I follow the accepted answer I get the error I mentioned. @Sorawee I get error paint: unbound identifier in: paint - Harry Moreno
Follow the instructions at docs.racket-lang.org/sicp-manual/…. In particular, use either (#%require sicp-pict) or (require sicp-pict) (depending on what language you are using). - Sorawee Porncharoenwase

2 Answers

1
votes

The paint-hires function is a left-over form the original MIT Scheme implementation. Back then it the "high resolution" was too slow to use, while experimenting - so paint-hires was used to get a "final" image.

When the original MIT Scheme implementation of the SICP Picture Language was ported to PLT Scheme paint-hires was kept.

Recently (within a year or two) the SICP Picture Language was reimplemented on modern Racket. This gives you the ability to use the Picture language with a resolution of your choice, colors! (the original MIT Scheme was used on monochrome displays) and more.

Make a copy of: "main.rkt" and einstein2.jpg" and save them in the same folder.

Open "main.rkt" in DrRacket and run it.

Look at the bottom for examples.

Add your own program at the bottom of "main.rkt".

Look through the files for how to use colors etc.

Both files are here: https://github.com/sicp-lang/sicp/tree/master/sicp-pict

0
votes

@sorawee-porncharoenwase thank you for the docs link. @soegaard thanks for the context for the recent changes to DrRacket.

What finally worked for me was this

#lang sicp
(#%require sicp-pict)

(paint (below (beside diagonal-shading
                      (rotate90 diagonal-shading))
              (beside (rotate270 diagonal-shading)
                      (rotate180 diagonal-shading))))

I think the docs incorrectly say to use paint-hires.