Advertisement
logicmoo

make a list of Xs

Dec 3rd, 2015
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.16 KB | None | 0 0
  1.  % Returns a list Xs which contains N copies of the item X
  2. inflate(X, 1, [X]):-!.
  3. inflate(X, N, [X|Xs]) :-
  4.           N1 is N - 1.
  5.          inflate(X, N1, Xs).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement