writetList([], Key). wrireList([H|T], Key) :- write(Key, H), nl, writeList(T, Key). writestuList(Cou , Key) :- Setof(ID, ^Mark examResult(Cou,ID,Mark), List), writeLst(List, Key). writeStudentList :- open('c:/studentList.txt', write, Key), writestuList(Cou , Key) close(Key).