Write a prolog predicate for a list, Programming Languages

Write a Prolog predicate remove_nth(N,L1,L2) that is true if list L2 is just list L1 with its Nth element removed. If L1 does not have an Nth element then the predicate should fail. You can assume that N is strictly greater than 0. For instance:

?- remove_nth(4,[a,e,e,d,s,e],L).

L = [a,e,e,s,e] ;

No

?- remove_nth(6,[a,b],L).

No

Posted Date: 3/22/2013 5:54:31 AM | Location : United States







Related Discussions:- Write a prolog predicate for a list, Assignment Help, Ask Question on Write a prolog predicate for a list, Get Answer, Expert's Help, Write a prolog predicate for a list Discussions

Write discussion on Write a prolog predicate for a list
Your posts are moderated
Related Questions
program for pyramid in shell script

Term project (you should code a function), demonstrate it to the class and a very breief report (one or two pages) describing what you did. You determine your project (could be imp

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

ADO. NET ADO.NET (ActiveX Information Things for .NET) is a set of programs elements that developers can use to accessibility data and data solutions. It is an element of the platf

(a) Write a procedure called (lookup n t). This procedure has 2 arguments: n is the value being looked up, t is the AVL tree. The subtree with n as its root is returned (or '() if

Recent problems in finishing implementation: This mobile application is built with Sencha Touch framework. Source code is attached in this zip package. The daily rest calc

1 Triple Eigenvalue with 2 Linearly Independent Eigenvectors       In this case we will have the eigen-value l with the two linearly independent eigenvectors  ?h 1 and  ?h 2

Use recursion to de ne a function position which has as input an integer, a character and a string and returns the result of inserting the character in the string at the position s

Write a Fortran LOGICAL FUNCTION, called "is_prime", which determines if a given integer value is a prime number or not (A prime number is a natural number which has only two disti

1.  Use mathematical induction to prove Whenever n is a positive integer. 2.  Use loop invariant to prove that the program for computing the sum of 1,...,n is correct.