Hello Freelancers,
My code simply finds the length of a list. First argument being a list, and the length of that list as its second argument.
Code below:
listlength([],0).
listlength([_|T],N) :- listlength(T,X), N is X+1.
I would like you to make it print out informative errors, for example ( “listlength/2: The first argument must be a list.”). You may use built-in predicates for error checking only.
Requirements:
Need code ASAP! No more than an hour :)