16 lines
363 B
Text
16 lines
363 B
Text
find_common_directory_path2(Dirs) = Path =>
|
|
common_prefix2(Dirs,Path,'/',_Len).
|
|
|
|
table(+,-,max)
|
|
common_prefix2(Ls,Prefix,Len) =>
|
|
common_prefix2(Ls,Prefix,[],Len).
|
|
|
|
table(+,-,+,max)
|
|
common_prefix2(Ls,Prefix,Last,Len) =>
|
|
foreach(L in Ls)
|
|
append(Prefix,_,L)
|
|
end,
|
|
if Last != [], Prefix != [] then
|
|
Prefix.last() == Last
|
|
end,
|
|
Len = Prefix.length.
|