May 3, 2010 #1 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).
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).
Jul 15, 2010 #3 kamileo Programmer Jul 15, 2010 6 PL It returns the N-element of the list. Upvote 0 Downvote