Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
-module(abbreviateweekdays).
|
||||
-export([ main/0 ]).
|
||||
|
||||
|
||||
uniq(L,Acc) ->
|
||||
io:fwrite("Min = ~p",[Acc]),
|
||||
io:fwrite(" Abbr:~p~n",[ sets:to_list(L) ]).
|
||||
|
||||
uniq(_, L, Acc) ->
|
||||
Abbr = [string:substr(X,1,Acc) || X <- L],
|
||||
% list of abbrevs, starting with substring 1,1:
|
||||
TempSet = sets:from_list( Abbr ),
|
||||
TempSize = sets:size(TempSet),
|
||||
if
|
||||
TempSize =:= 7 ->
|
||||
uniq(TempSet,Acc);
|
||||
true -> uniq(0, L, Acc+1)
|
||||
end.
|
||||
|
||||
read_lines(Device, Acc) when Acc < 19 ->
|
||||
case file:read_line(Device) of
|
||||
{ok, Line} ->
|
||||
Tokenized = string:tokens(Line," "),
|
||||
uniq(0,Tokenized,1),
|
||||
read_lines(Device, Acc + 1);
|
||||
eof ->
|
||||
io:fwrite("~p~n",["Done"])
|
||||
end;
|
||||
|
||||
read_lines(Device, 19) ->
|
||||
io:fwrite("~p~n",["Done"]).
|
||||
|
||||
|
||||
main() ->
|
||||
{ok, Device} = (file:open("weekdays.txt", read)),
|
||||
read_lines(Device, 1).
|
||||
Loading…
Add table
Add a link
Reference in a new issue