I am trying to find the largest word out of several thousand instances of word(apple). word(bob). .. and so on. I am a noobie at this, but here is my current (not working) attempt:
maxlength(Start):-
word(X),
equal(Counter, Start),
string_atom(Y, X),
string_length(Y, Length),
Length > Counter ->
(cntr_set(Counter, Length), write(Counter);
write($Not Greater$)),
write(Counter), write(Length).
Any help would be wonderful.
maxlength(Start):-
word(X),
equal(Counter, Start),
string_atom(Y, X),
string_length(Y, Length),
Length > Counter ->
(cntr_set(Counter, Length), write(Counter);
write($Not Greater$)),
write(Counter), write(Length).
Any help would be wonderful.