! increment the value, or if the key does not exist, set the value to 1 : increment-val-for-key ( key assoc -- ) 2dup at* [ 1 + ] [ drop 1 ] if -rot ! have key assoc val, need val key assoc for input to set-at set-at ; ! count the number of occurrences of each character in str : count-occurrences ( str -- assoc ) V{ } dup -rot [ increment-val-for-key ] curry each ;