2

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?

Harry Moreno
  • 10,231
  • 7
  • 64
  • 116
  • We need some more info. Which scheme implementation did you chose? How did you run code? What that code is? – rsm Jan 14 '19 at 04:02
  • I googled and found http://www.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 Jan 14 '19 at 04:03
  • @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 Jan 14 '19 at 06:04
  • 3
    Follow the instructions at http://docs.racket-lang.org/sicp-manual/index.html?q=sicp#%28part._.Example%29. In particular, use either `(#%require sicp-pict)` or `(require sicp-pict)` (depending on what language you are using). – Sorawee Porncharoenwase Jan 14 '19 at 10:48

2 Answers2

1

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

soegaard
  • 30,661
  • 4
  • 57
  • 106
1

@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.

Harry Moreno
  • 10,231
  • 7
  • 64
  • 116