Skip to content

Instantly share code, notes, and snippets.

@Falci
Created June 4, 2014 16:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Falci/470763d15ef333f21a7d to your computer and use it in GitHub Desktop.
Save Falci/470763d15ef333f21a7d to your computer and use it in GitHub Desktop.
Criar lista em Prolog
criarLista(X, R) :-
criarLista(X, [], R).
criarLista(2, L, R) :-
R = '.'(2,L),
!.
criarLista(X, L, R) :-
T = '.'(X, L),
Xn is X -1,
criarLista(Xn, T, R).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment