I need to unify all terms in database to one variable.
For given code:
man('a').
man('b').
main :-
prompt(_, ''),
man(X),
write(X),
nl,
halt.
I get output:
a
I need to get something like:
['a','b']
Is it possible? I know about retract/1, which deletes the term from database, I could iterate trough all theese facts and retract them from database one by one, but that seems to be like shoting in the leg. Any given advice is apreciated.
findall/3to retrieve a list of results, sofindall(X, man(X), L)will generate a listL = ['a', 'b']. - Willem Van Onsem