(define-struct student (first last major))
(define student1 (make-student "John" "Smith" 'CS))
(define student2 (make-student"Jane" "Jones" 'Math))
(define student3 (make-student "Jim" "Black" 'CS))
#;(define (same-major? s1 s2)
(symbol=? (student-major s1)
(student-major s2)))
当我输入这些时,我得到了我期望的答案。
;;(same-major? student1 student2) -> FALSE
;;(same-mejor? student1 student3) -> True
但是当我想知道学生是否有相同的名字时,它告诉我他们期望一个符号作为第一个参数,但给定的是 John。
(define (same-first? s1 s2)
(symbol=? (student-first s1)
(student-first s2)))
我究竟做错了什么?