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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:26:06+00:00 2026-05-22T16:26:06+00:00

how can I find a list from given database?? Database: (10 math phys) (11

  • 0

how can I find a list from given database??
Database:

(10 math phys)

(11 math chem)

(13 bio chem)

(15 geo phys)

I want to implement time which shows the first and second exams in a list.

>(time ’10)

(list ‘math ‘phys)

>(time ’19)

empty

And I want to implement secondExams which returns the time of second exams.

>(secondExams ‘phys)

(list ‘10 ’15)

>(secondExams ‘chem)

(list ’11 ’13)

thank you

  • 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-22T16:26:07+00:00Added an answer on May 22, 2026 at 4:26 pm

    First, let’s clarify your database format. Make it a list of lists:

    (define database
      '((10 math phys)
        (11 math chem)
        (13 bio chem)
        (15 geo phys)))
    

    Then time just needs to step through your list recursively, and compare the first element of the sub-list with your target value. If we find no matching value, we’ll return the empty list. We’ll do this in a helper procedure to match the functionality you’re precisely seeking.

    (define time-ish
      (lambda (target lst)
        (cond ((null? lst) lst)
              ((eq? target (caar lst)) (cdar lst))
              (else
               (time-ish target (cdr lst))))))
    
    (define (time lookin-for)
      (time-ish lookin-for database))
    

    Then we can do something very similar for secondExams. Except we’ll recursively build a list of matches this time.

    (define exam-helper
      (lambda (target lst)
        (cond ((null? lst) lst)
              ((eq? target (third (car lst))) (cons (first (car lst))
                                                    (exam-helper target (cdr lst))))
              (else
               (exam-helper target (cdr lst))))))
    
    (define (secondExams lookin-for)
      (exam-helper lookin-for database))
    

    I haven’t tested this code, but I’m pretty sure it’ll work for you.

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

Sidebar

Related Questions

How can I find out which node in a tree list the context menu
Anyone know where i can find a list of the columns for setting the
I would like to know where I can find the list of properties settable
Where can I find a list of all types of bsd style socket errors?
Where can I find a list of all the C# Color constants and the
Where can I find a list of transitions for bringing a new Viewcontroller onto
How can I find whether a singly linked list is circular/cyclic or not? I
I have a list of interconnected edges ( E ), how can I find
This is only tangentially a programming question. Where can I find a simple-to-parse list
I find it annoying that I can't clear a list. In this example: a

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.