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 9204869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:48:53+00:00 2026-06-17T23:48:53+00:00

(define-struct animal (name species age breakfast-hour dinner-hour)) (define-struct attendant (name a1 a2 a3)) (define

  • 0
(define-struct animal (name species age breakfast-hour dinner-hour))  
(define-struct attendant (name a1 a2 a3))
(define attendant1 (make-attendant "Dave" 'gorillas 'bats 'mandrills ))
(define attendant2 (make-attendant "John" 'crocodiles 'ocelots 'capybara ))                                  
(define attendant3 (make-attendant "Joe" 'pottos 'tapirs 'vultures ))

How would I add data definitions to these? All this currently gives me is “(E.g. ;; An animal is…)”.

  • 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-17T23:48:54+00:00Added an answer on June 17, 2026 at 11:48 pm

    First you define the structures:

    (define-struct animal (name species age breakfast-hour dinner-hour))
    (define-struct attendant (name a1 a2 a3))
    

    Then, the animals (because you need to create these before assigning them to attendants):

    (define gorilla (make-animal "Koko" "Gorilla" 4 8 10))
    (define bat (make-animal "Bruce" "Bat" 1 23 5))
    (define mandrill (make-animal "Manny" "Mandrill" 5 8 10))
    (define crocodile (make-animal "Swampy" "Crocodile" 1 10 18))
    (define ocelot (make-animal "Ozzy" "Ocelot" 7 7 17))
    (define capybara (make-animal "Capy" "Capybara" 4 6 18))
    (define potto (make-animal "Spot" "Potto" 2 2 6))
    (define tapir (make-animal "Stripey" "Tapir" 3 10 17))
    (define vulture (make-animal "Beaky" "Vulture" 10 9 19))
    

    And finally, you create the attendants, giving each guy or gal their corresponding animals:

    (define attendant1 (make-attendant "Dave" gorilla bat mandrill))
    (define attendant2 (make-attendant "John" crocodile ocelot capybara))
    (define attendant3 (make-attendant "Joe" potto tapir vulture))
    

    Notice that for creating the attendants, we must reference one of the previously defined animals.

    • 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: #define sbuffer 128 #define xbuffer 1024 typedef struct{ char name[sbuffer];
(define-struct student (first last major)) (define student1 (make-student John Smith 'CS)) (define student2 (make-studentJane
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.