Created
          December 6, 2012 12:50 
        
      - 
      
- 
        Save athos/4224221 to your computer and use it in GitHub Desktop. 
    clojure.coreで定義されている変数・関数名の長さのリスト。名前の平均の長さは約8.3文字。
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | user=> (def freq (frequencies (map #(count (str %)) (keys (ns-publics 'clojure.core))))) | |
| #'user/freq | |
| user=> (doseq [[l n] freq] (printf "%2d %s\n" l (apply str (repeat n \*)))) | |
| 1 ******* | |
| 2 **************** | |
| 3 **************************** | |
| 4 ********************************************************************** | |
| 5 ******************************************************* | |
| 6 ******************************************************** | |
| 7 **************************************************************** | |
| 8 *************************************** | |
| 9 ********************************************* | |
| 10 ********************************************** | |
| 11 ********************************** | |
| 12 ********************** | |
| 13 ************************ | |
| 14 **************** | |
| 15 **************** | |
| 16 ******* | |
| 17 ****** | |
| 18 ********** | |
| 19 *** | |
| 20 ******** | |
| 21 *** | |
| 22 ** | |
| 23 ** | |
| 25 * | |
| nil | |
| user=> (double (/ (apply + (for [[l n] freq] (* l n))) (apply + (vals freq)))) | |
| 8.348275862068967 | |
| user=> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment