countwords/simple_ordered_map.fz
# Inspiration: https://github.com/benhoyt/countwords count_words_ctrie_ordered_map is counts := mut (container.ordered_map String u64 [] []) # NYI this is broken currently io.stdin.with ()-> do io.buffered.read_line .split .map(t -> t.lower_case) .for_each (token)-> counts <- (counts.get.add token (counts.get[token].get (u64 0))+1) # ^--- NYI isse #1051 for count in (counts.get.items.sort x,y->x.values.1>y.values.1) do say "{count.values.0} {count.values.1}" unit