このディレクトリの索引

#  Fileから項をストリームを使わず読みだして、そのままのリストとします。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

file_to_list(File,List) :-
        see(File),
        file_to_list(List),
        seen,!.

file_to_list([X|R]) :-
        read(X),
        \+(X=end_of_file),
        file_to_list(R).
file_to_list([]).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

file_to_list(File,List) :-
        see(File),
        read(X),
        file_to_list(X,List),
        seen.

file_to_list_1(end_of_file,[]) :- !.
file_to_list_1(X,[X|R]) :-
        read(Y),
        file_to_list_1(Y,R).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

file_to_list(File,List) :-
        see(File),
        findall(X,repeat_read(X),List),
        seen.

repeat_read(X) :-
        read(X),
        (   X=end_of_file,!,fail;
            true ).
repeat_read(X) :-
        repeat_read(X).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

file_to_list(File,List) :-
        see(File),
        findall(X,(
                    repeat,
                    read(X),
                    (   X=end_of_file,!,fail;
                        true )),
                List),
        seen.