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

  • Home
  • SEARCH
  • 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 5932095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:47:14+00:00 2026-05-22T14:47:14+00:00

I could not solve this challenging problem: name(jack, math, 50). name(daniel, math, 60). name(jane,

  • 0

I could not solve this challenging problem:

name(jack, math, 50).
name(daniel, math, 60).
name(jane, phys, 70).
name(eto, comp, 73).

predicate : nameGrade(P, L, S). P is the list of people who are taking lesson L and whose grade is greater than S.

nameGrade([jack], math, 45). returns true

nameGrade([jack, daniel], math, 55). returns false. (because jack scored 50 which is less than 55)

nameGrade([], phys, 80). returns true

nameGrade(X, math, 70). returns X=[jack, daniel]

nameGrade([jack, daniel], math, X). returns X=50. (the less one).

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-22T14:47:15+00:00Added an answer on May 22, 2026 at 2:47 pm

    You can use findall/3 to return a list of elements satisfying a predicate:

    nameGrade(P, L, S) :- is_list(P), name(_, _, S), findall(X, (name(X, L, S0), S0 >= S), P).
    nameGrade(P, L, S) :- number(S), findall(X, (name(X, L, S0), S0 >= S), P).
    

    However, there are some contradictory goals in your requirement. For example, nameGrade([jack], math, 45) should fail because both jack and daniel take math and have higher scores than 45. nameGrade(X, math, 70) should return [] because no one takes math with a higher score than 70.

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

Sidebar

Related Questions

I have been trying to solve this problem for a while, could not find
I've searched a lot but could not solve this problem. I am generating PDF
how i solve this error The type or namespace name 'ThemeInfo' could not be
I have a strange problem that I could not solve. When I try to
I've been searching on how to solve this issue but could not find any
Just could not get this one and googling did not help much either.. First
I could not find the function that returns the name of the cell referenced.
I could not find a clear answer to this question elsewhere, so I'll try
I'm sorry I could not think of a better title. The problem is the
Here is some code I could not get to format properly in markdown, this

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.