A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
|
|
@ -0,0 +1,11 @@
|
|||
scommon(a, b) := block([n: min(slength(a), slength(b))],
|
||||
substring(a, 1, catch(for i thru n do (
|
||||
if not cequal(charat(a, i), charat(b, i)) then throw(i)), n + 1)))$
|
||||
|
||||
commonpath(u, [l]) := block([s: lreduce(scommon, u), c, n],
|
||||
n: sposition(if length(l) = 0 then "/" else l[1], sreverse(s)),
|
||||
if integerp(n) then substring(s, 1, slength(s) - n) else ""
|
||||
)$
|
||||
|
||||
commonpath(["c:/files/banister.jpg", "c:/files/bank.xls", "c:/files/banana-recipes.txt"]);
|
||||
"c:/files"
|
||||
Loading…
Add table
Add a link
Reference in a new issue