fork(3) download
  1. longitud([], 0).
  2. longitud([X|Xs], N) :- longitud(Xs, N1), N is N1 + 1.
  3.  
  4. ?- longitud([2,4,6,8], X), write('longitud: '), writeln(X).
Success #stdin #stdout #stderr 0.02s 7740KB
stdin
Standard input is empty
stdout
longitud: 4
stderr
Warning: /home/oOoDJF/prog:2:
	Singleton variables: [X]
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit