(define-struct student (first last major age))
(define student1 (make-student "David" "Smith" 'Math 19))
(define student2 (make-student"Joe" "Jones" 'Math 21))
(define student3 (make-student "Eli" "Black" 'Spanish 20))
(define (same-age? s1 s2)
(string=? (student-age s1)
(student-age s2)))
so I am trying to get a boolean as an output if two students are the same age, but when I run it, it says it expects a string as the 1st argument, but given 19. What is the problem?
You create students with their
agefields being integers, not strings (note the lack of double-quotation marks), then try to usestring=?function to compare them. You should either use the=function to compare onage:or create students with their
agefields represented as strings: