Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prolog Quick question.

Status
Not open for further replies.

snaps11

Programmer
May 3, 2010
1
US
Prolog quick question

Explain what the following Prolog code does. Assume the third parameter is the result.

a( 1, [Hd | _Tl], Hd ).
a( N, [_ | Tl], Elem ) :-
N > 1,
N1 is N - 1,
a( N1, Tl, Elem).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top