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
Of the 6,325 kindergarten students who participated in the study, almost half or 3,052 were eligible for a free lunch program. The categorical variable sesk (1 == free lunch, 2 = n

.NET class library .NET structure comes with just one category selection. And that all developers need to learn!! Whether they create the value in C# or VB.NET or J#, it doesn't

Write a program to compute: 1.)    Mixing ratio, W=.622[Vapor pressure/(pressure-vapor pressure)] 2.)    Virtual temperature, VT=T(1+0.61 mixing ratio) = T(1+.61W) 3.)

Question 1- In engineering applications it is often necessary to fit a straight line to a set of N points with known coordinates (xi, yi), where i indexes the points (N in total).

Expertsmind brings you unique solution in java assignments I.O streams The Java.io packages contains nearly every category you might ever need to execute feedback and resu

I need help getting started with a class project of creating a project in the Perl programming language. I was thinking of maybe doing an employee directory

How does a program provide "input" to one of its functions?


Consider the following schema (DTD) and sample instance document: name    ID      #REQUIRED spouse  IDREF   #IMPLIED job     CDATA   #IMPLIED > ]>

non restoring division