Define a prolog predicate that asserts list, Programming Languages

Define a Prolog predicate flatten(List, FlattenedList)  that asserts List  is any nested list of atoms and  FlattenedList  is the same list with the nesting removed. The atom [] should also be removed. Your predicate should only produce one answer. You may use the built-in predicates not, ! and append. Do not use a helper predicate.

?- flatten([a, [[b,c],d], [[e]], [f]], X).

X = [a,b,c,d,e,f] ;

no

?- flatten([a,[[]], [[c,d],e]], X).

X = [a,c,d,e] ;

no

Posted Date: 3/22/2013 5:55:25 AM | Location : United States







Related Discussions:- Define a prolog predicate that asserts list, Assignment Help, Ask Question on Define a prolog predicate that asserts list, Get Answer, Expert's Help, Define a prolog predicate that asserts list Discussions

Write discussion on Define a prolog predicate that asserts list
Your posts are moderated
Related Questions
1 Problem Description The task of the assignment is to build a book recommendation system for Auer Libraries. The system is to be implemented in Prolog and as the owners of t

Develop a Windows Forms Application by creating a new project named "xxxxxxxx" in a new folder named "xxxxxxxxas3" where xxxxxxxx is your student id. You should delete file(s) with

Short Arrays: Array = randi(10,1,randi(6,1,1)+4)-5 This command will generate an array which you should be able to evaluate by hand (and also have your code evaluate for te

Characteristics of procedure-oriented programming: Emphasis is on doing things (algorithms). Large programs are divided into smaller programs known as functions.

Does anyone know anything about java programming here?

Each of the following two procedures defines a method for adding two positive integers in  terms of the procedures inc, which increments its argument by 1, and dec, which decrement

In this assignment you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application. You

Applications of OOP, The promising areas for application of OOP include: Real-time systems Simulation and modelling Object-oriented databases Hypertext, hype


A psychologist is interested in learning about the voting behavior of college students.  (4 points for each part.)Design a study which would yield data on this topic. a. state y