longitud([], 0).longitud([X|Xs], N) :- longitud(Xs, N1), N is N1 + 1. ?- longitud([2,4,6,8], X), write('longitud: '), writeln(X).
Standard input is empty
longitud: 4
Warning: /home/oOoDJF/prog:2: Singleton variables: [X] ERROR: '$runtoplevel'/0: Undefined procedure: program/0 Exception: (3) program ? EOF: exit
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!