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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:04:55+00:00 2026-06-14T10:04:55+00:00

Trying to figure out how to create a member function for a list. So

  • 0

Trying to figure out how to create a “member” function for a list. So far I’ve created this but I’m getting no where near to the correct answer.


spec([system001,hard_drive(50)]).
spec([system002,hard_drive(150)]).

list1(Component):-
    spec([Component,X|Y]).

which_system(Component, Component).

which_system(Component):-
    list1(Component),
    which_system(X, Component).

When I type in which_system(system001).
it works but when i put in which_system(hard_drive(50)).
it wont work at all… I dont know how to make it to find hard_drive(50).

I hope someone can help…

Thanks.

  • 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-14T10:04:56+00:00Added an answer on June 14, 2026 at 10:04 am

    you’re doing it more complex than needed

    which_system(Component, System) :-
      spec([System|Components]), member(Component, Components).
    

    This works also if you’ll have more components in a system, for instance spec([system001, hard_drive(50), hard_drive(100)])..

    ?- which_system(hard_drive(50), S).
    

    will instance S to system001.

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

Sidebar

Related Questions

I am trying to figure out how this DropDownListFor works but with no success.
I am trying to figure out how to create a temporary table that is
I am trying to figure out how to create an image gallery like the
I'm trying to figure out how to create a http CRAN-repository. I've tried to
i am trying to figure out how to create a javascript alert box asking
I am trying to figure out how to create 3 divs and have them
I'm trying to figure out how to create personalized urls for double-byte languages. For
I am very new to Python, and trying to figure out how to create
I'm trying to figure out the best way to create a row of three
I'm trying to figure out the best way to create three 284x87 rounded rectangle

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.