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
I want to set up automatic Amazon login

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

My programming class uses Virtual Logic (not virtual studio) to learn how to program algorithms but we don''t get any assistance form the instructor so I am at a loss as to how I a

Add macros to MS word 2010 according to A PARTICULAR FORMAT


i doing a project about depth estimation, i have done some research, and i used the block matching algorithm to get the motion vectors from the image sequences, i now have the prob

How to run java program?

How does a Case Structure differ from a Case structure program in pseudocode

Write a program that inputs two positive integers of, at most, 20 digits and outputs the sum of the numbers. If the sum of the numbers has more than 20 digits, output the sum with

how do u define a letter in python "NameError: name ''r'' is not defined"