Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

Prolog program to delete an element from a given list without using concatenate

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

Prolog program to delete an element from a given list without using concatenate.

Code for Prolog program to delete an element from a given list without using concatenate in Artificial Intelligence

domains
    x = integer
    l = integer*
    
predicates
    delete(x,l,l)

clauses
    delete(Element,[Element|Tail],Tail).
    
    delete(Element,[Head|Tail],[Head|Tail1]) :-
        delete(Element,Tail,Tail1).
        
Output :

Goal: delete(3,[4,2,6,3],List)

List=[4,2,6]
1 Solution
  
Share: 



Milind Mishra
Milind Mishra author of Prolog program to delete an element from a given list without using concatenate 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!