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 @@
|
|||
: take-shorter ( seq1 seq2 -- shorter )
|
||||
[ shorter? ] 2keep ? ;
|
||||
|
||||
: common-head ( seq1 seq2 -- head )
|
||||
2dup mismatch [ nip head ] [ take-shorter ] if* ;
|
||||
|
||||
: common-prefix-1 ( file1 file2 separator -- prefix )
|
||||
[ common-head ] dip '[ _ = not ] trim-tail ;
|
||||
|
||||
: common-prefix ( seq separator -- prefix )
|
||||
[ ] swap '[ _ common-prefix-1 ] map-reduce ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue