[racket] HTDP 5.1.5

From: Jeremy Duenas (jduenas23 at gmail.com)
Date: Mon Jan 31 11:25:03 EST 2011

Ok so I wrote and compiled my code:

[code]
;;check-color: symbol symbol symbol symbol -> symbol
;;consumes four colors. 1 player picks two colors, the 2nd player guesses
the colors. check-color simulates the 1st players checking action. It
consumes four colors. The 1st two arguments to check-color are "targets" and
the latter two are "guesses". the function produces one of the four
answers.
;;example: (master check-color) = 'Perfect
;;         (masster check-color) = 'OneColorCorrectPosition
;;         (master check-color) = 'OneColorOccurs
;;         (master cheeck-color) = NothingCorrect
(define t1 'red)
(define t2 'green)

(define (check-color t1 t2 g1 g2)
  (cond
    [(and (= t1 g1)(= t2 g2)) 'Perfect]
    [(or (= t1 g1)(= t2 g2)) 'OneColorOccurs]
    [(or (or (= t1 g1)(= t1 g2))(or (= t2 g1)(= t2 g2))) 'OneColorOccurs]
    [else 'NothingCorrect]))
[/code]

It compiles correctly, but then when I run it using the master.ss  teachpack
as told (master check-color) and choose two colors, I get the error:
 =: expects type <number> as 1st argument, given: 'green; other arguments
were: 'red

can someone explain what I did wrong and how to correct this.


Jeremy D. Duenas
714.864.9686
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110131/b9e997a1/attachment.html>

Posted on the users mailing list.