help for a beginner please!

Start from chapter 1

if you don't have a book, there's plenty of tutorials available on the web

1) find the 3rd element of a list?

find_third([_, _, THIRD | _ ], THIRD).

test with

find_third([h, e, l, l, o], THIRD).

2) concatenation of three copies

- only one level deep

triple([A, A, A | _ ]) :- !.

triple([A, B, C | TAIL]) :-

triple([B, C | TAIL]).

test

triple([h, e, l, l, l]).

good luck

if you haven't figured out the code above, tough shit

Kee

Quote:

> I am trying to do the following:

> 1) Find the 3rd element of a list

> 2) whether a list is a concatenation of three copies of the same sublist.

> All this by only using 'append.' I'm so confused about this problem that I

> don't know where to start. I've thought about and tried to write some code

> but I'm at a very confused stage! please if you can give me a start I

would

> be eternally grateful.