12 lines
291 B
Text
12 lines
291 B
Text
find_common_directory_path(Dirs) = Path =>
|
|
maxof( (common_prefix(Dirs, Path,Len), append(_,"/",Path)), Len).
|
|
|
|
%
|
|
% Find a common prefix of all lists/strings in Ls.
|
|
% Using append/3.
|
|
%
|
|
common_prefix(Ls, Prefix,Len) =>
|
|
foreach(L in Ls)
|
|
append(Prefix,_,L)
|
|
end,
|
|
Len = Prefix.length.
|