Define a prolog predicate that asserts list, Programming Languages

Assignment Help:

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


Related Discussions:- Define a prolog predicate that asserts list

Version control systems - delete and update, The next major set of tasks to...

The next major set of tasks to tackle are delete and update. Version control systems typically version updates to a ?le and only store the differences between the ?les. Two system

Expressions and truth tables, Create a logical expression that corresponds ...

Create a logical expression that corresponds to the following statement: If you like talking about computers or playing video games at LAN parties, and you want to meet others w

Assembly Language, need a program of any multiplication algorithm implement...

need a program of any multiplication algorithm implemented in assembly language x86 without using mul command

Fortran source code, For this programming assignment, you are to develop a ...

For this programming assignment, you are to develop a Fortran 90/95/2003 program to automate a useful task. The aim of the assignment is for you to reveal your competence in the Fo

Hb programming test, The purpose of the HB Programming test is to assess wh...

The purpose of the HB Programming test is to assess whether a candidate has sufficient knowledge to join our team here and beyond that where they would fit within our teams. The

Java exception handling, Expertsmind brings you unique solution in java as...

Expertsmind brings you unique solution in java assignments Exception Handling An exception is an issue that appears during the performance of an application. An exception

Compare 2 strings, Normal 0 false false false EN-US X...

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

Cmis 102, In this assignment, you will design a program to perform the foll...

In this assignment, you will design a program to perform the following task: Calculate the total price to purchase all the components required to build a state-of-the-art gaming c

Random number generator guessing game, The GuessingGame class contains a sk...

The GuessingGame class contains a skeleton for a program to play a guessing game with the user. The program should randomly generate an integer between 1 and 10 and then ask the us

What is hiding a method? explain, Question 1 Explain the three traits of O...

Question 1 Explain the three traits of Object Oriented Programming Question 2 Write a note on (a) Assignment Operators                             b) Bitwise Operators.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd