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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:49:40+00:00 2026-05-25T14:49:40+00:00

It comes from my homework assignments. There is a family tree a + b

  • 0

It comes from my homework assignments. There is a family tree

                             a  +  b
                         /   |    |   \ 
                        c+u  d+c  e+w  f
                     / | \        / \
                 m+x  n+y  o      p  q
                  |
                  r

a and b is the oldest. and every married people the second person is not part of the original family.
Now I need to write the spouse, sibling, children ,grandchildren, parents and grandparents function.

I wrote the list as below:
( (father mother) chlid1 child2 child3)

(((a b) c d e f) ((c u) m n o) ((d v) nil) ((e w) p q) (f nil) ((m x) r) ((n y) nil) (o nil) (p nil) (q nil)  )

I have some problems with sibling function, here is my code.

(defun sibling  (arglst lst)  
 (cond
        ((eql 
             arglst (cdr (car lst))) 
                 (rest (cdr lst))
         )
   (T (sibling (rest lst) arglst))

)

I knew it was wrong, but I don’t how to revise it.. and I also need some help with other functions. hope can get some hints from u guys.

  • 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-05-25T14:49:41+00:00Added an answer on May 25, 2026 at 2:49 pm

    Since this is homework, I won’t give the full solution, but this should suffice for you to solve the rest:

    (defparameter *family* '(((a b) c d e f)
                             ((c u) m n o)
                             ((d v) nil)
                             ((e w) p q)
                             (f nil)
                             ((m x) r)
                             ((n y) nil)
                             (o nil)
                             (p nil)
                             (q nil)))
    
    (defun siblings (person family)
      "Return a list of PERSON's siblings."
      (remove person (cdr (find person family :key #'cdr :test #'member))))
    
    (defun siblingsp (person1 person2 family)
      "Are PERSON1 and PERSON2 siblings?"
      (find person2 (siblings person1 family)))
    
    (defun parents (person family)
      "Return a list of PERSON's parents."
      (car (find person family :key #'cdr :test #'member)))
    
    (defun parentp (parent child family)
      "Is PARENT a parent of CHILD?"
      (find parent (parents child family)))
    

    Try it:

    CL-USER> (siblings 'p *family*)
    (Q)
    CL-USER> (siblingsp 'q 'p *family*)
    P
    CL-USER> (parents 'p *family*)
    (E W)
    

    Now, to find the grandparents for example, you just have to understand what grandparents are: (A list of) The parents of both parents. Then, ask yourself how it is for grandchildren. Finally, the spouse function should be rather easy, given this example.

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

Sidebar

Related Questions

My problem comes from HTML dropdown select not able to preserve multiple consecutive whitespaces
This code comes from a tutorial so it's not originally my own work. What
The string input comes from textarea where users are supposed to enter every single
Data comes from Wordpress metabox in a form of single long array. The data
This code comes from: http://code.activestate.com/recipes/577090-file-encryption-using-stream-cipher/ import sys import random if len(sys.argv) != 4: print
My programming background comes from C and some C++ programming with strong emphasis on
As someone who comes from the world of Object Orientation, I find it rather
This regex comes from Atwood and is used to filter out anchor tags with
Anybody knows where the :// or the // comes from in most URIs syntaxes?
I'm working with an NSImage which comes from a PDF. When I initially create

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.