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
append two text files vertically

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Use an insertion sort to sort an array (sequence) of long word integers. The size of the list will appear just before the list itself. Use the same labels as in this example: LE

Overview Goals: The goals for this assignment are Design and implement instantiable classes. Use arrays of objects. Read from and write to files. Implement basic

How to build one dimensional list from string and build string from a list? Suppose input string is: STACKOVERFLOW then the output list should be outputList = [S,T,A,C,K,O,V,E,R,F

Windows Presentation Foundation Designed by Microsoft Technologies, the Microsoft Technologies windows Display Groundwork (or WPF) is a computer-software graphic subsystem for maki

Is there one can help me in the language Lisp and Prolog

Topic Develop a Web site that will provide information about your organization. The Web site will need to have a user-friendly interface for users to enter their information;

Example- Arithmetic :  Given the subsequent two matrices, So calculate A-5B. Solution There isn't much to do now other than the work. We first multiplied

Figure is a representation of the solar system. In a basic model of the same concentric orbits planets rotate around the sun. The closer the Planet in less time Sun completes a ful