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