I am looking a problem here and need some help
recursive definition of append
append([]A,A).
append([H|T1], A, [H|T2]):-(T1, A, T2)
(a.) ?-append(L,[x,z],[y,x,z]
my answer
L3 = [L]|[Lo]
?- append ([], [x,y], L0.
L0 = []|L1
(b.) write rule for append1(l1, l2, l3,l4) to be true if and only if l4 is the same as l1,l2, and l3 append in that order
my answer
append1([], A, A, A).
append1([H|T1], A, A, [H|T4]):-append1(T1, A, A, T4)
(c.) using append write rule to define shorten(l1, l2) to be true if and only if l2 can be obtained by removing the first and last elements of l1.
shorten(L1, L2) :- shorten([H]|[_N], L2)
(d.) use shorten write rule that defines even(l) to be true if and only if l is a list of even number
shorten(l1,l2):-even(l,X) //where x is 2
(e.) state steps prolog would take to solve shorten([1,2,3],l)
need some guidance struggling here
[1]|[,2,3]
[2][3]
[3]
General Discussion
- Caffeine Lounge
- Corner Cubicle
- Student Campus
- Software Development
- Industry News
- Introduce Yourself
- Nightmare.In.Code
Programming Help
- C and C++
- VB.NET
- Java
- C#
- ASP.NET
- .NET Framework
- VB6
- PHP
- Ruby
- Python
- ColdFusion
- Databases
- Other Languages
- Game Development
- Mobile Development
- 52 Weeks Of Code
Web Development
- Web Development
- HTML & CSS
- JavaScript
- Graphic Design
- Flash & ActionScript
- Blogging
- SEO & Advertising
- Web Servers & Hosting
- Site Check
Follow & Share
Give It A Try!
Tutorials
Programming
- C++ Tutorials
- Java Tutorials
- VisualBasic Tutorials
- VB.NET Tutorials
- C# Tutorials
- PHP Tutorials
- ColdFusion Tutorials
- Database Tutorials
Web Development
Reference Sheets
Code Snippets
- C++ Source Code
- Java Source Code
- C# Source Code
- VB.NET Source Code
- PHP Source Code
- C Source Code
- Visual Basic Source Code
- JavaScript Source Code
- Python Source Code
- Other Languages Source Code
DIC Chatroom
Bye Bye Ads
Monthly Drawing

New Topic/Question
Reply




MultiQuote
|