09/07/23 22:26:34
>>554
% Prolog (1/2)
t554(_入力ファイル,_出力ファイル,_空白文字数) :-
length(L,_空白文字数),
all(L,' '),
get_chars(_入力ファイル,Chars),
replace_chars(Chars,['\t'],L,Chars2),
put_chars(_出力ファイル,Chars2).
replace_chars([],_,_,[]) :- !.
replace_chars(L1,L2,L3,L4) :-
append(L2,R1,L1),
replace_chars(R1,L2,L3,L5),
append(L3,L5,L4),!.
replace_chars([A|R1],L2,L3,[A|R4]) :-
replace_chars(R1,L2,L3,R4).