src/MapOfStrings.php
public function letter_frequency()
    {
        return $this->transform(
            function ($frequencies, $word) {
                foreach (count_chars($word, 1) as $byte => $frequency) {
                    $letter = chr($byte);
                    if ($frequencies->has($letter)) {
                        $frequencies->set($letter, $frequencies->get($letter)+1);
                    } else {
                        $frequencies->set($letter, 1);
                    }
                }
            },
            function (Map $original) { return new MapOfInts(); }
        );
    }
public function letter_frequency()
    {
        return $this->transform(
            function ($frequencies, $word) {
                foreach (count_chars($word, 1) as $byte => $frequency) {
                    $letter = chr($byte);
                    if ($frequencies->has($letter)) {
                        $frequencies->set($letter, $frequencies->get($letter)+1);
                    } else {
                        $frequencies->set($letter, 1);
                    }
                }
            },
            function (Map $original) { return new MapOfInts(); }
        );
    }
public function letter_frequency ( ) { return $ this -> transform ( function ( $ frequencies , $ word ) { foreach ( count_chars ( $ word , 1 ) as $ byte => $ frequency ) { $ letter = chr ( $ byte ) ; if ( $ frequencies -> has ( $ letter ) ) { $ frequencies -> set ( $ letter , $ frequencies -> get ( $ letter ) + 1 ) ; } else { $ frequencies -> set ( $ letter , 1 ) ; } } } , function ( Map $ original ) { return new MapOfInts ( ) ; } ) ; }
Calculate frequency of letters in all strings.

Counts how many times each letter occurs within every string in this
map.  Returns a new Map of letter to number of occurrences.  Only
letters that appear will be in the resulting map.

@return \Haldayne\Boost\MapOfIntegers
@api
Calculate frequency of letters in all strings .