Determine last element of a list using prolog

Assignment Help Basic Computer Science
Reference no: EM1348673

1. Using Prolog as the programming language for LOGIC, construct the relevant command to do the following tasks:-

Prolog Lists - A list is either empty or it is composed of a first element (head) and a tail, which is a list itself. In Prolog we represent the empty list by the atom [] and a non-empty list by a term [H|T] where H denotes the head and T denotes the tail.
(NOTE:- Given list MySenarai= [a,b,c,d,e,f, g, h] for the tasks listed below)

i. Find the last element of a list.

ii. Find the K'th element of a list. (K=5)

iii. Eliminate consecutive duplicates of list elements.

iv. Find the number of elements of a list.

Reference no: EM1348673

Questions Cloud

Illustrate what type of industry benefits the most : Illustrate what type of industry benefits the most from technological innovation? Select an article from either either a peer reviewed or current popular periodical on an industry of your choice and discuss this question from the perspective of th..
Introduction to cellular macromolecules : Cellular macromolecules to which a drug binds to initiate its effects are known as:
Determine the value of h : A 755N diver drops from a board 10m above the water's surface. Find out the diver's speed 5m above the water's surface. Then find the diver's speed just before striking the water.
Explain the role that the objective setting process : Explain the role that the objective setting process plays in how and if auditing objectives are met and what are some steps you can take to ensure that you consistently meet the objectives of an audit?
Determine last element of a list using prolog : Using Prolog as programming language for LOGIC, create relevant command to do following tasks:-Determine the last element of a list. Find K'th element of list. (K=5)
Calculate unit cost for toughenuf engines : A lawnmower manufacturing company built 1000 ToughEnuf engines driving the post year incurring the following direct cost
Explain what marketing channels are in regards direct sales : I want to say in four paragraphs that explain what marketing channels are in regards to (1) direct sales, social media, where I sell directly on the Internet or through advertising directed to the consumer
Calculate the transmitted intensity : Three polarizing plates whose planes are parallel are centered on a common axis. The directions of the transmission axes relative to common vertical direction.
Illustrate what are the major factors that have affected us : Illustrate what are the major factors that have affected U.S. household consumption since the recession in 2001.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Leverage business intelligent-create meaningful information

Include how we can leverage business intelligent to create meaningful information and decision making systems to help keep cost and profits.

  Explaining seven steps of information gathering

Write and explain the seven steps of information gathering.

  Relative risk comes form inside the organisation

Write a report on relative risk that comes form inside organisation as opposed to risk which comes from external sources.

  Methods-majority of target audience can play applications

What are some methods that we can guarantee that majority of target audience can play applications?

  Program to randomly select three numbers

Write a program to randomly select the numbers of 3 finalist to recieve a prize. Make sure not to pick the same number twice.

  Adding two unsigned and signed binary numbers

Add the two binary numbers and interpret the sum assuming that the numbers are (1) unsigned, and (2) signed.

  Storing and compiling a large amount of data

Because information systems are able to store and compile a large amount of data, many people worry that, their private data will end up in the wrong hands. Explain your position.

  Task manager to recognize and troubleshoot problems

Which system resources are probable to be at root of problem? How can you use system tools, like the Task Manager, to help recognize and troubleshoot these problems?

  Describe what is downward solution

The Conflict Resolution Phase can be thought of as control strategy, describe four types of such strategy Describe what is downward solution

  Explaining parse tree n-m nodes

W has derivation of m steps, show that w has a parse tree n+m nodes.

  Explaining the available bandwidth as function of n

Assuming average packet size is 5 slot times, expreess the available bandwidth as a function of N?

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

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