Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

Prolog program to use of list

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 2264

Prolog program to use of list.

Code for Prolog program to use of list in Artificial Intelligence

domains

    list=symbol*


predicates

    member(symbol,list)


clauses

    member(X,[X|Tail]).
    
    member(X,[Head|Tail]):- 
        member(X,Tail).


OUT PUT
=======

Goal: member(b,[a,b,c,d])
Yes

Goal: member(x,[a,b,c,d])
No

Goal: member(X,[a,b,c,d])
X=a
X=b
X=c
X=d
4 Solutions
  
Share: 


Didn't find what you were looking for? Find more on Prolog program to use of list Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of Prolog program to use of list is from India.
 
View All Articles

 

Other Interesting Articles in Artificial Intelligence:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!