Search code examples
racket

Some 2htdp/image functions are not working


I was following along with my racket practice when i tried drawing a circle and got an error.

    #lang racket
    > (square 40 "solid" "slateblue")
    square: this function is not defined

I tried rectangle and works just fine

> (rectangle 40 40 "solid" "slateblue")
> .

Some other functions like wedge and triangle/saa also didn't work.

I'm using DrRacket version 8.8. I already tried switching to advanced student without avail.

What am I missing? I already included the htdp/image techpack and read the documentation but I can't pinpoint what I'm doing wrong.


Solution

  • There are two htdp/image teachpacks- htdp/image and 2htdp/image.

    htdp/image is deprecated and doesn't contain square function. Use 2htdp/image:

    #lang racket
    (require 2htdp/image)
    (square 40 "solid" "slateblue")
    (rectangle 40 40 "solid" "slateblue")