Define a prolog predicate flatten, 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 flatten

Multi-targeting .net structure, Support for Multi-Targeting The multi-targe...

Support for Multi-Targeting The multi-targeting function of Vision Facilities allows you specify the particular edition or account of the .NET Structure that is required for your p

Write a recursive procedure that computes number in integer, (a) Write a re...

(a) Write a recursive procedure (digits n) that computes the number of digits in the integer n using a linear recursive process. For example, (digits 42) should return 2 and (digit

Unix help, need a command to : Display user id, first and last names of all...

need a command to : Display user id, first and last names of all the students the class specified by the prefix in alphabetical order by last name from /etc/passwd

We are looking for on-call developers, Pre-order integration on Shopify sto...

Pre-order integration on Shopify store We are looking for on-call developers who can integrate Celery on client Shopify stores. Requirements a) Contented editing Shopify them

Pseudo code for random numbers, Pseudo code the shows logic for a program ...

Pseudo code the shows logic for a program that generates a random number, then ask the user to think of a number between 1 and 10

How to write a kernel module, Overview You will write a loadable kernel...

Overview You will write a loadable kernel module. If you have an idea which you can convince me is a good idea that can not be done as a module, but only via direct modificatio

Program on car purchasing simulation, Introduction A new online syst...

Introduction A new online system for purchasing carsis being designed and you have been contracted to write a C# console application program that models the proposed functio

What is an authentication subsystem, Question: (i) All Security authen...

Question: (i) All Security authentication mechanism that run on the TRU64 Unix Operating system run under the Security Integration Architecture (SIA ) layer. Explain with di

3-Tier Architecture in asp.net, I am getting error at business layer object...

I am getting error at business layer object in code behind page.

Need help to convert a site to nationbuilder, Need help to convert a site t...

Need help to convert a site to NationBuilder This project is to transfer the site- (podiotools.com) which is by now responsive HTML and is currently setup in Adobe Business Cata

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