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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:52:39+00:00 2026-06-03T02:52:39+00:00

Is it possible to define a list, that consists of predicates and how do

  • 0

Is it possible to define a list, that consists of predicates and how do I call the predicates.

Also, is it possible to pass one predicate to another predicate (like passing atoms)?

Example:

pre1:- something.
pre2(Predicate1, List):-
    call(Predicate1),
    append([Predicate1], List, R),
    .....
  • 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-03T02:52:40+00:00Added an answer on June 3, 2026 at 2:52 am

    You can’t store predicates in a list, but you can store terms (or functors) and call terms as goals.

    Here’s a predicate that tests whether a term has the properties described by a list of functors:

    has_properties([], _).
    has_properties([P|Ps], X) :-
        Goal =.. [P, X],            % construct goal P(X)
        call(Goal),
        has_properties(Ps, X).
    

    Usage:

    % is 4 a number, an integer and a foo?
    ?- has_properties([number, integer, foo], 4).
    

    The answer to this query will depend on your definition of foo/1, of course. See my explanation of =.. if needed.

    Edit: as @false reports in the comments, it’s not necessary to use =.., since Goal =.. [P, X], call(Goal) can be replaced by call(P, X) will have the same effect. It might still be worthwhile learning about =.., though, as you may encounter it in other people’s code.

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

Sidebar

Related Questions

Is it possible to define a list with a fixed size that's 100? If
Is it possible to define a recursive list comprehension in Python? Possibly a simplistic
Possible Duplicate: Define a method that has many (or infinite) arguments I have the
It's possible to define an alias in C# like this using kvp = System.Collections.Generic.KeyValuePair<string,
Is it possible to define a different multi-column approach for a list view in
I have to define a List and it has two types of possible values
Is it possible to define in XML schema that there must be some certain
I've got a flag-holding integer that has an existing set of possible flags: #define
I would like to define a class named List like this: class List {
Is it possible to modify the list of defines/include paths passed to the Visual

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.