1 ! Copyright (C) 2009 Maximilian Lupke.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs kernel math.ranges sequences ;
8 : prefixes ( seq -- prefixes )
9 dup length [1..b] [ head ] with map ;
13 : abbrev ( seqs -- assoc )
15 '[ dup prefixes [ _ push-at ] with each ] each
18 : unique-abbrev ( seqs -- assoc )
19 abbrev [ nip length 1 = ] assoc-filter ;