[racket] HTDP 5.1.5

From: Jeremy Duenas (jduenas23 at gmail.com)
Date: Mon Jan 31 12:20:35 EST 2011

Thank you so much. I was able to figure it out. I don't know why I didn't
think of utilizing the symbol=?
After re-reading the error and not over thinking it I was able to see what I
needed to do

Jeremy D. Duenas
714.864.9686



On Mon, Jan 31, 2011 at 8:25 AM, Jeremy Duenas <jduenas23 at gmail.com> wrote:

> 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/9f36bce5/attachment.html>

Posted on the users mailing list.