Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9242001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:29:18+00:00 2026-06-18T08:29:18+00:00

(define-struct student (first last major)) (define student1 (make-student John Smith ‘CS)) (define student2 (make-studentJane

  • 0
(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)))

when I type these in, I get the answer I expect.

;;(same-major? student1 student2) -> FALSE
;;(same-mejor? student1 student3) -> True

But when I want to find out if the students have the same first name, it tells me that they expect a symbol as a 1st argument, but given John.

(define (same-first? s1 s2)
  (symbol=? (student-first s1)
            (student-first s2)))

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:29:20+00:00Added an answer on June 18, 2026 at 8:29 am

    'CS and 'Math are symbols, “John”, “Jane” and “Jim” are not (they’re strings). As the error message is telling you, the arguments to symbol=? need to be symbols.

    To compare strings for equality, you can use string=? or just equal? (which works with strings, symbols and pretty much everything else).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(define-struct student (first last major age)) (define student1 (make-student David Smith 'Math 19)) (define
In Scheme, I can use define-struct to make a binary search tree, but how
I have this struct for people: (define-struct person ( first ; a string: first
(define-struct restaurant (name address lod)) (define-struct dish (name main-ingredient price)) (define lod (list (make-dish
I'm using a struct like this: define struct _Fragment{ int a; char *seq; }Fragment;
struct { char a; int b; } x; Why would one define a struct
#define MAX 100 struct bs{ int ab; int ac; }be; struct s{ be b;
I have this struct; #define BUFSIZE 10 struct shared_data { pthread_mutex_t th_mutex_queue; int count;
Is it valid C to declare a struct and define values enclosed in {}?
Is is possible to define a macro BREF(...): struct bits { int b0:1; int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.