make-posn returns #<posn> instead of posn

77 Views Asked by At

I am trying to get a feel for the draw library in Scheme, but I've already had a problem.

(define defaultpos (make-posn 400 400))
(start 800 800)
(draw-circle defaultpos 10 'green)

In theory, this should open up a new window with a green circle in the middle. Instead, I get this error message:

draw-circle: expects a posn as first argument, given #<posn>

I've tried just making a list with two elements in it as the position, but that obviously doesn't work. Next, I checked whether the defaultpos was actually a posn struct, which it is.

(posn? defaultpos)
> #t

Can anybody help me?

1

There are 1 best solutions below

0
On BEST ANSWER

Are you sure you're using the right language and imports? Set your language to "beginning student" and try this, it works for me:

(require htdp/draw)

(define defaultpos (make-posn 400 400))
(start 800 800)
(draw-circle defaultpos 10 'green)