Author: | randy7 |
---|---|
Mode: | factor |
Date: | Mon, 5 Jan 2009 09:04:37 |
! similar to what "array_count_values" in php does. : count-seq ( seq -- seq' ) dup '[ _ swap '[ _ = ] count ] map ; ! fry first, map second ... i think :) : count-dups ( seq -- seq ) dup count-seq zip prune >array ;
Author: | randy7 |
---|---|
Mode: | factor |
Date: | Mon, 5 Jan 2009 09:15:35 |
: just-2+ [ dup second 2 < [ drop f ] when ] map harvest ; ! example: ! { "hi" "hi" "there" } count-dups just-2+ .