
:- dynamic filme/3, filme/2.

salvar(Base, F):-
    write(Base, F),
    write(Base, '.\n').

    
escrever :-
    findall(filme(X,Y), filme(X,Y), LF),
    length(LF, N), 
    open("said.pl", append, Base),
    replicar(Base, N, ListaB),
    maplist(salvar, ListaB, LF),
    close(Base).


 
 replicar(_, 0, []) :-!.
 replicar(X, N,  [X|L]) :- N > 0,  N1 is N-1,  replicar(X,N1,L).


