[racket] why is the comparimng always false
Hello,
I try to figure out how I can check if a struct is a Vcat or a Vcham.
So i tried this:
; – a VCham
(define-struct Vanimal (animal))
; a struct has two parts ( the x-coordinate of a cat and the happiness
of the cat)
(define-struct Vcat [x happiness])
; make Vcat : number (x) number (h)
; Vcat x -> number
; Vcat h -> number
; Any Vcat? -> Boolean
; a struct has two parts ( the x-coordinate of a kamneleon and the
happiness of the kameleon)
(define-struct Vcham [x happiness])
; make Vcham : number (x) number (h)
; Vcham x -> number
; Vcham -> number
; Vanimal -> Boolean
; Function which cehcks if a struct is a Vcat
(check-expect (check (make-Vanimal(make-Vcat 0 100))) true)
(check-expect (check (make-Vanimal(make-Vcham 0 100))) false)
(define (check s)
( equal? s Vchat)
(check(make-Vanimal (make-Vcat 0 100)))
But the answer is false not mather if the struct is a Vchat or a Vcham.
Where am I missing something.
Roelof