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] ;


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

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


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
showing work Ubuntu system or either opensuse

Question 1 What is CISC & RISC? Explain their addressing modes Question 2 Discuss the following- Design Specification of Assembler Design of Single Pass Assembler

1. Logon to Linux. 2. Create a directory "Unix" under your home directory. Command(s): …………………………………………. 3. Create four sub-directories bin, conf, docs

how can we get the data from data base to combo box in jsp page dynamically

Expertsmind brings you unique solution in java assignments Event Delegation Model The Delegation Model with java assignment help Version 1.1 of the Java TM foundation

how to concatinate two strings in assembly

Example problem Imagine that  you  require  to create  a robot  that  will  roll up  close to a light  lamp  and  stop  a fixed distance from it.  The first question is, how w

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

Write a program that draws the initials J G P on the form similar to that shown in Fig J 1 (using straight lines and curve semicircles). The figure can not have corners. All ends a

Need help with a cobol program.