SWI/Prolog пытаюсь сделать запись в файл, но постоянно получаю ошибку: ERROR: Unknown procedure: save_flights/0 (DWIM could not correct goal)
?- save_flights. ERROR: Unknown procedure: save_flights/0 (DWIM could not correct goal) ^ Exception: (4) setup_call_cleanup('$toplevel':notrace(call_repl_loop_hook(begin, 0)), '$toplevel':'$query_loop'(0), '$toplevel':notrace(call_repl_loop_hook(end, 0))) ?
Вот что выводится. Каждый раз сохраняю файлик, в котором код. Потом в SWI/Prolog -> Consult Пишет, что все окей % c:/Studing/Представление знаний/Search/Search.pl compiled 0.00 sec, -1 clauses
flight(1, "Paris", 500).
flight(2, "London", 600).
flight(3, "Rim", 450).
flight(1, "Berlin", 550).
flight(5, "Madrid", 700).
flight(3, "Moscow", 450).
flight(5, "Kazan", 550).
flight(4, "Madrid", 900).
%Работаем с пользователем
menu :-
format('~t~w~t~40|~n',['MENU']),nl,
write('flights - display all flights'),nl,
write('find_flight - find all flight destinations'),nl,
write('find_price - find flights in the price range'),nl,
write('save_flights - save all flights'),nl,
write('save_find_price - save flights of the price range'),nl,
write('save_find_flight - save flights with destinations'),nl.
%предикаты вывода
print_table :-
format('| ~t~s~t~8| | ~t~s~t~22| | ~t~s~t~25| |~n', ['Flight', 'Destination', 'Price']),
write('--------------------------------'),nl,
flight(X,Y,Z),
format('| ~t~w~t~8| | ~t~w~t~22| | ~t~w~t~30| |~n', [X, Y, Z]), fail.
print_table(X) :-
format('| ~t~s~t~8| | ~t~s~t~22| | ~t~s~t~25| |~n', ['Flight', 'Destination', 'Price']),
write('--------------------------------'),nl,
flight(X,Y,Z),
format('| ~t~w~t~8| | ~t~w~t~22| | ~t~w~t~30| |~n', [X, Y, Z]), fail.
print_table(Min, Max) :-
format('| ~t~s~t~8| | ~t~s~t~22| | ~t~s~t~25| |~n', ['Flight', 'Destination', 'Price']),
write('--------------------------------'),nl,
flight(X, Y, Z),
Z =< Max, Z >= Min,
format('| ~t~w~t~8| | ~t~w~t~22| | ~t~w~t~30| |~n', [X, Y, Z]), fail.
%предикаты
flights:-
print_table.
find_flight:-
write('Enter the flight number: '), read(X),
print_table(X).
find_price:-
write('Min price: '), read(Min), nl,
write('Max price: '), read(Max), nl,
print_table(Min, Max).
write_save_flights_to_file(Filename) :-
tell(Filename),
save_flights,
told.
%предикаты записи
save_flights :-
%write_to_file('C:\Studing\Search1\SearchFile.txt'),
%write('File is saved').
write_save_flights_to_file('C:\Studing\Search1\SearchFile.txt').