Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!topaz!lll-crg!booter From: booter@lll-crg.ARpA (Elaine Richards) Newsgroups: net.ai,net.lang.prolog Subject: HELP!!!!! Message-ID: <1465@lll-crg.ARpA> Date: Wed, 14-May-86 05:00:11 EDT Article-I.D.: lll-crg.1465 Posted: Wed May 14 05:00:11 1986 Date-Received: Thu, 15-May-86 07:22:03 EDT Organization: The Booban Renewal Department Lines: 24 Xref: linus net.ai:3216 net.lang.prolog:662 I have been given this silly assignment to do in Prolog, a language which is rapidly losing my favor. We are to do the folowing: Define a Prolog predicate len(N,L) such that N is the length of list L. Define a Prolog predicate nth(X,N,L) such that X is the Nth element of list L. I cannot seem to instantiate N past the value 0 on any of these. My code looks like this: len(N,[]) :- 0 !. len(N,[_|Y] :- N! is N + 1,len(N1,L]. It gives me an error message indicating "_6543etc" or somesuch ghastly number/variable refuses to take the arithmetic operation. The code for nth is similar and gives a similar error message. Please send replies to {whateverthepathis}lll-crg!csuh!booter. E *****