! the idea is to find repeating code in factor ! just experimenting from the listener - using probably needs more. USING: io.encodings.utf8 fry grouping sets ; : count-seq ( seq -- seq' ) dup '[ _ swap '[ _ = ] count ] map ; : count-dups ( seq -- seq ) dup count-seq zip prune >array ; : just-2+ ( seq -- seq ) [ dup second 2 < [ drop f ] when ] map harvest ; "resource:basis/alarms/alarms.factor" utf8 file-contents ! TODO: should actually scan the entire factor dirs into one string. sorry i'm still learning :D ! TODO: remove \n \r and all double-spaces.. " " split [ length >array 20 head [ 1+ ] map ] keep '[ _ swap clump [ " " join ] map ] map count-dups just-2+ [ [ second ] bi@ <=> ] sort reverse