Re: how to make a list of N 1s



makeOnes(0,[]).
makeOnes(N,[1|T]) :- N1 is N-1, makeOnes(N1,T).

this does not work, when I say makeones(3,L), it finds L=[1,1,1], but
if I say find another solution by typing ";" it enters into a infinite
loop...
but a slight modification make it work. here it is:

makeOnes(0,[]) :- !.
makeOnes(N,[1|T]) :- N1 is N-1, makeOnes(N1,T).


anyway, thank you very much...

.