Write a prolog predicate has duplicates, Programming Languages

Write a Prolog predicate has_duplicates(L) that is true if list L contains duplicated elements (that is at least 2 copies of an element). For instance:

?- has_duplicates([a,e,b,d,s,e]).

Yes

?- has_duplicates([a,b,d,s,e]).

No

?- has_duplicates([]).

No

 

Posted Date: 3/28/2013 3:52:19 AM | Location : United States







Related Discussions:- Write a prolog predicate has duplicates, Assignment Help, Ask Question on Write a prolog predicate has duplicates, Get Answer, Expert's Help, Write a prolog predicate has duplicates Discussions

Write discussion on Write a prolog predicate has duplicates
Your posts are moderated
Related Questions
I need an application that will gather data from one SQL Database and update another. Data is contained in dbo.CallList with following fields: Customer_ID, AlreadyPickedUp, Phone_N

New Features of Visual Studio 2008 1. LINQ Support LINQ primarily is the structure of many conventional question employees that allow you to perform with information in a more user

i need help

Define an Example of Switch Statement? estimate(number) int number; /* Estimate a number as none, one, two, several, many */ {       switch(number) { case 0 :

Name : Jaya Malathy IC No : 99011460923 Quiz 1 : 20.5 Quiz 2 : 22.5 Quiz 3 40.5 Total marks = 83.5 Name IC No Quiz1 Quiz2 Quiz3 Grade --- ---- ---- ---- ---- ---- Jaya 990

Programming Project Specification: IRC or Internet Relay Chat is an application that lets multiple users communicate via text messages with each other in common "virtual" rooms.

This assignment is divided into two parts. The goal is to write a Java program that calculates capital gain on a stock market, see Lab 7. When a share of common stock of some co

I have a problem which seems to be quite a rare one and I can safely say I know what exactly what is causing it. After some process of elimination I reached the conclusion that, in

The creation of the menu will involve writing procedural code, using decision logic, writing a loop, and using the case statement.  Although it is not required for grading, it is r

Suppose L is a context-free language and L' is regular. Show that L∩ L' is a context- free language. Specifically, if you're given a PDA diagram of L and a DFA diagram for L' , des