Paste: tinkering
Author: | randy7 |
Mode: | factor |
Date: | Mon, 5 Jan 2009 10:16:49 |
Plain Text |
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
" " split
[ length >array 20 head [ 1+ ] map ] keep
'[ _ swap clump [ " " join ] map ] map
count-dups just-2+
[ [ second ] bi@ <=> ] sort reverse
Author: | randy7 |
Mode: | factor |
Date: | Sat, 17 Jan 2009 23:15:16 |
Plain Text |
"resource:basis/alarms/alarms.factor" utf8 file-contents
"[\n|\r|\t|\s\s]" <regexp> " " re-replace
[ length >array 20 head [ 1+ ] map ] keep
[ swap clump ] curry map
count-dups just-2+
[ [ second ] bi@ <=> ] sort reverse
Author: | randy7 |
Mode: | factor |
Date: | Sat, 17 Jan 2009 23:43:42 |
Plain Text |
all-source-files [ utf8 file-contents ] map " " join
"[\n|\r|\t|\s\s]" <regexp> " " re-replace
[ length >array 20 head [ 1+ ] map ] keep
" " split harvest
[ swap clump ] curry map
[ [ " " join ] map ] map
count-dups just-2+
[ [ second ] bi@ <=> ] sort reverse
New Annotation