My goal is to return the longest list in a list of lists. For example: [[1,2,3],[1,2]]-> [1,2,3].
I wrote this
list_max_len([L],L).
list_max_len([X,Y|T],L):-
length(X) >=length(Y),
list_max_len([X|T],L).
list_max_len([X,Y|T],L):-
length(X) < length(Y),
list_max_len([Y|T],L).
But i got this error:
can someone explain what it is?

It is unclear exactly what Prolog implementation you're using. However,
length/1is not a predicate that would compute the length of a list. That, standard/ISO predicate islength/2.Try something like this (assuming that you're allowed to use the in-built
length/2: