Skip to content

Instantly share code, notes, and snippets.

@joesavage
Created March 4, 2016 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joesavage/8ddd76d5b9292557befe to your computer and use it in GitHub Desktop.
Save joesavage/8ddd76d5b9292557befe to your computer and use it in GitHub Desktop.
row(0, R, R) :- !.
row(N, R, Acc) :- L is N - 1,
row(L, R, [N | Acc]).
% LESS EFFICIENT VERSION:
% row(0, []) :- !.
% row(N, R) :- L is N - 1,
% row(L, S),
% append(S, [N], R).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment