Define a prolog predicate flatten, 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/28/2013 3:53:59 AM | Location : United States







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

Write discussion on Define a prolog predicate flatten
Your posts are moderated
Related Questions
Create a visualization (programming project) and demonstrate it in the class. The project should be related to distributed systems. (A distributed system consists of multiple auton

Input to be in the form of a string of less than 256 characters. Assume that this character string (record) can only be of the form: Last Name, First Name, Box number, City, St

Introduction Each module of the course includes a programming project. However, for Modules 5 and 6 we will do a single project to cover both. The purpose of the programming p

You are to Use ASCII operations to design an IA-32 assembly language program which will do addition and subtraction on positive integers of any length represented in characters. T

how much it will cost? i need learn how to make rightsided triangle in forloop


We need help for build a Price Quote Generator I am interested in two things (A) a web based system that will allow a user to enter the parameters of their contests (there are o

write a procedure to add toolbar in VB application adding icons to toolbar buttons & with the approprite example display the use of each button

depth estimation from block matching algorithm motion estimation

Write a program to mask bits D3D2D1D0 and to set bits D5D4 and to invert bits D7D6 of the AX register.