emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use of `dash` and `s` functions by MELPA packages


From: Phillip Lord
Subject: Re: Use of `dash` and `s` functions by MELPA packages
Date: Tue, 27 Jan 2015 23:39:57 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Fairly interesting. Suggests that the lambda forms are more used,
although the anaphoric forms are close behind. I would imagine different
people are using the two forms -- although the anaphoric forms are
naturally limited, so there is a reason why someone might use both.

5% using dash is pretty amasing, and 4% with s. My own interpretation is
that Emacs could do with more of these kind of libraries -- richer APIs
for interacting with a few datatypes. I've had a fairly nice experience
with f.el as well.


Alexis <address@hidden> writes:

> Hi all,
>
> Out of interest, i've written a simple Perl5 script to analyse the
> extent to which the various functions in the `dash` and `s` packages are
> used by packages on MELPA. i've included the script within the org-babel
> block at the end of this message; i imagine there are various issues
> with its methodology and/or implementation, but feel it's at least a
> starting point. Variables at the top of the script allow it to be
> modified to analyse the use of libraries other than `dash` and `s`.
>
> Comments in the script describe how i built all packages locally for the
> script to work on. The download and build process took around 4 hours,
> via a cable 'net connection and a Core i5 with 4G of RAM. Running the
> script takes less than 10 minutes to complete on my system.
>
>
> --- Results ---
>
> ###
> ### Usage of 'dash' by MELPA packages
> ###
>
> 'dash' is used by 259/4506 files (5.75%).
>
>
> # Function usage counts, sorted by decreasing frequency
>
> Count       %       Function
> -----------------------------------------
>  311      14.55     -when
>  299      13.99     -map
>  159       7.44     --map
>   97       4.54     -filter
>   91       4.26     --each
>   76       3.56     -each
>   76       3.56     --filter
>   74       3.46     -if
>   60       2.81     -contains
>   52       2.43     -flatten
>   48       2.25     --first
>   42       1.97     -first
>   36       1.68     -last
>   36       1.68     --remove
>   35       1.64     -remove
>   30       1.40     --when
>   29       1.36     -mapcat
>   26       1.22     -any
>   25       1.17     -difference
>   25       1.17     --reduce
>   24       1.12     -reduce
>   24       1.12     -concat
>   24       1.12     --any
>   22       1.03     -elem
>   22       1.03     -distinct
>   21       0.98     -union
>   17       0.80     -find
>   17       0.80     -all
>   16       0.75     -take
>   16       0.75     -sort
>   16       0.75     --if
>   15       0.70     -select
>   15       0.70     -drop
>   15       0.70     --mapcat
>   14       0.66     -partial
>   14       0.66     --sort
>   12       0.56     -let
>   11       0.51     -zip
>   11       0.51     -snoc
>   11       0.51     -slice
>   11       0.51     -partition
>   10       0.47     --keep
>    8       0.37     -repeat
>    8       0.37     -non
>    8       0.37     -min
>    8       0.37     --all
>    7       0.33     -intersection
>    7       0.33     -interpose
>    6       0.28     -keep
>    6       0.28     -insert
>    6       0.28     -dotimes
>    6       0.28     --group
>    6       0.28     --find
>    6       0.28     --dotimes
>    5       0.23     -tree
>    5       0.23     -list
>    5       0.23     --separate
>    4       0.19     -replace
>    4       0.19     -max
>    4       0.19     -lambda
>    4       0.19     --drop
>    3       0.14     -value
>    3       0.14     -iterate
>    3       0.14     -is
>    3       0.14     -group
>    3       0.14     --take
>    2       0.09     -separate
>    2       0.09     -interleave
>    2       0.09     -cons
>    2       0.09     -clone
>    2       0.09     --split
>    2       0.09     --last
>    1       0.05     -update
>    1       0.05     -table
>    1       0.05     -sum
>    1       0.05     -split
>    1       0.05     -only
>    1       0.05     -butlast
>    1       0.05     -annotate
>    1       0.05     --zip
>    1       0.05     --tree
>    1       0.05     --partition
>    1       0.05     --none
>    1       0.05     --max
>    0       0.00     -unfold
>    0       0.00     -splice
>    0       0.00     -same
>    0       0.00     -rotate
>    0       0.00     -product
>    0       0.00     -pad
>    0       0.00     -none
>    0       0.00     -grade
>    0       0.00     -fix
>    0       0.00     -cycle
>    0       0.00     -count
>    0       0.00     --update
>    0       0.00     --unfold
>    0       0.00     --splice
>    0       0.00     --only
>    0       0.00     --min
>    0       0.00     --iterate
>    0       0.00     --fix
>    0       0.00     --count
>    0       0.00     --annotate
>
>
> # Function usage counts, sorted by function name
>
> Function                       Count      %
> ---------------------------------------------
> --all                            8       0.37
> --annotate                       0       0.00
> --any                           24       1.12
> --count                          0       0.00
> --dotimes                        6       0.28
> --drop                           4       0.19
> --each                          91       4.26
> --filter                        76       3.56
> --find                           6       0.28
> --first                         48       2.25
> --fix                            0       0.00
> --group                          6       0.28
> --if                            16       0.75
> --iterate                        0       0.00
> --keep                          10       0.47
> --last                           2       0.09
> --map                          159       7.44
> --mapcat                        15       0.70
> --max                            1       0.05
> --min                            0       0.00
> --none                           1       0.05
> --only                           0       0.00
> --partition                      1       0.05
> --reduce                        25       1.17
> --remove                        36       1.68
> --separate                       5       0.23
> --sort                          14       0.66
> --splice                         0       0.00
> --split                          2       0.09
> --take                           3       0.14
> --tree                           1       0.05
> --unfold                         0       0.00
> --update                         0       0.00
> --when                          30       1.40
> --zip                            1       0.05
> -all                            17       0.80
> -annotate                        1       0.05
> -any                            26       1.22
> -butlast                         1       0.05
> -clone                           2       0.09
> -concat                         24       1.12
> -cons                            2       0.09
> -contains                       60       2.81
> -count                           0       0.00
> -cycle                           0       0.00
> -difference                     25       1.17
> -distinct                       22       1.03
> -dotimes                         6       0.28
> -drop                           15       0.70
> -each                           76       3.56
> -elem                           22       1.03
> -filter                         97       4.54
> -find                           17       0.80
> -first                          42       1.97
> -fix                             0       0.00
> -flatten                        52       2.43
> -grade                           0       0.00
> -group                           3       0.14
> -if                             74       3.46
> -insert                          6       0.28
> -interleave                      2       0.09
> -interpose                       7       0.33
> -intersection                    7       0.33
> -is                              3       0.14
> -iterate                         3       0.14
> -keep                            6       0.28
> -lambda                          4       0.19
> -last                           36       1.68
> -let                            12       0.56
> -list                            5       0.23
> -map                           299      13.99
> -mapcat                         29       1.36
> -max                             4       0.19
> -min                             8       0.37
> -non                             8       0.37
> -none                            0       0.00
> -only                            1       0.05
> -pad                             0       0.00
> -partial                        14       0.66
> -partition                      11       0.51
> -product                         0       0.00
> -reduce                         24       1.12
> -remove                         35       1.64
> -repeat                          8       0.37
> -replace                         4       0.19
> -rotate                          0       0.00
> -same                            0       0.00
> -select                         15       0.70
> -separate                        2       0.09
> -slice                          11       0.51
> -snoc                           11       0.51
> -sort                           16       0.75
> -splice                          0       0.00
> -split                           1       0.05
> -sum                             1       0.05
> -table                           1       0.05
> -take                           16       0.75
> -tree                            5       0.23
> -unfold                          0       0.00
> -union                          21       0.98
> -update                          1       0.05
> -value                           3       0.14
> -when                          311      14.55
> -zip                            11       0.51
>
>
> # Files using 'dash', sorted by usage count
>
> Usage(s)  File
> -----------------------------------------
>  162      smartparens
>  108      projectile
>   74      prodigy
>   74      emr-elisp
>   49      origami
>   40      skeletor
>   38      flycheck
>   38      bog
>   37      clj-refactor
>   36      magnatune
>   36      js2r-functions
>   34      cask
>   33      cake2
>   30      turnip
>   29      dired-subtree
>   28      dired-filter
>   25      m-buffer
>   24      f
>   24      cider-interaction
>   23      workgroups2
>   22      malinka
>   22      jumblr
>   21      virtualenvwrapper
>   21      helm-bibtex
>   21      ecukes-run
>   20      wacs-interactive
>   20      ecukes-reporter
>   18      wonderland
>   18      sclang-doc-mode
>   18      anaconda-mode
>   17      ox-pandoc
>   17      commander
>   15      projectile-rails
>   15      elmacro
>   15      color-identifiers-mode
>   15      bts
>   13      wacs-configuration
>   13      omnisharp
>   13      fsharp-mode-completion
>   13      bbdb-csv-import
>   12      sclang-ac-mode
>   12      rswitcher
>   12      org-drill-table
>   12      httprepl
>   12      dash-functional
>   11      sclang-extensions-utils
>   11      org-trello-controller
>   11      nrepl-client
>   11      litable
>   11      keyset
>   11      ert-modeline
>   11      ecukes-parse
>   10      undercover
>   10      sclang-extensions
>   10      packed
>   10      org-trello-data
>   10      org-trello-buffer
>   10      helm-projectile
>   10      emr-c
>   10      emr
>   10      ebib-utils
>   10      dired-ranger
>   10      cider-spy
>   10      cask-cli
>    9      org-trello-proxy
>    9      org-transform-tree-table
>    8      git
>    8      flycheck-mercury
>    8      edbi-django
>    8      company-tern
>    8      color-moccur
>    8      cider-test
>    7      wrap-region
>    7      smart-mode-line
>    7      req-package
>    7      psci
>    7      eyebrowse
>    7      ecukes-helpers
>    7      dired-hacks-utils
>    7      creds
>    7      cider-stacktrace
>    7      ansi
>    6      soundklaus
>    6      quickref
>    6      paradox
>    6      nvm
>    6      multifiles
>    6      markdown-toc
>    6      malabar-reflection
>    6      malabar-mode
>    6      evil-visual-mark-mode
>    6      edts-project
>    6      ebib
>    5      string-edit
>    5      smartparens-html
>    5      scala-outline-popup
>    5      pallet
>    5      orgit
>    5      org-trello-action
>    5      malabar-project
>    5      lxc
>    5      lentic-asciidoc
>    5      jvm-mode
>    5      interval-tree
>    5      imgix
>    5      helm-flycheck
>    5      grass-mode
>    5      ert-runner
>    5      ensime-config
>    5      dired-open
>    5      decl
>    5      cider
>    5      ag
>    4      with-editor
>    4      web
>    4      wacs-util
>    4      relative-buffers
>    4      org-trello-backend
>    4      op-export
>    4      navorski
>    4      minitest
>    4      malabar-import
>    4      js2r-helpers
>    4      espuds
>    4      esh-help
>    4      elwm
>    4      edts-xref
>    4      ecukes-load
>    4      ecukes-cli
>    4      ecukes
>    4      clocker
>    3      wand
>    3      thumb-frm
>    3      tco
>    3      simplezen
>    3      shadchen
>    3      servant
>    3      rake
>    3      org-trello-cbx
>    3      omnisharp-utils
>    3      omnisharp-server-actions
>    3      omnisharp-auto-complete-actions
>    3      noflet
>    3      mustache-render
>    3      magma-scan
>    3      lentic-block
>    3      flycheck-haskell
>    3      flycheck-ert
>    3      emamux-ruby-test
>    3      cdnjs
>    3      camcorder
>    3      bibslurp
>    3      auto-compile
>    3      ace-jump-buffer
>    2      ycmd
>    2      tree-buffer
>    2      travis-version
>    2      solarized
>    2      rubocop
>    2      recompile-on-save
>    2      py-test
>    2      prosjekt
>    2      pip-requirements
>    2      outshine
>    2      outline-magic
>    2      org-trello-hash
>    2      misc-cmds
>    2      marmalade-client
>    2      malabar-util
>    2      malabar-service
>    2      magma-smie
>    2      magit-find-file
>    2      js2r-vars
>    2      js2-refactor
>    2      ivs-edit
>    2      inf-fsharp-mode
>    2      helm-projectile-all
>    2      hamlet-mode
>    2      grunt
>    2      go-projectile
>    2      gnomenm
>    2      gitlab-version
>    2      gitlab-ui
>    2      flycheck-pos-tip
>    2      flycheck-d-unittest
>    2      ensime-company
>    2      ensime-client
>    2      enh-ruby-mode
>    2      edts-navigate
>    2      ecukes-steps
>    2      ecukes-core
>    2      doremi-frm
>    2      date-field
>    2      company-anaconda
>    2      cider-util
>    2      cider-grimoire
>    2      cider-eldoc
>    1      with-namespace
>    1      wacs-init
>    1      trident-mode
>    1      travis-utils
>    1      tern-django
>    1      tbx2org
>    1      tagedit
>    1      sonic-pi-console
>    1      smartparens-config
>    1      serverspec
>    1      sclang-post-mode
>    1      replace-from-region
>    1      projmake-elmm
>    1      overseer
>    1      orglink
>    1      org-trello-utils
>    1      org-trello-setup
>    1      org-trello-entity
>    1      org-trello-api
>    1      org-trello
>    1      org-projectile
>    1      marcopolo-version
>    1      malabar-semanticdb
>    1      malabar-ede-maven
>    1      maker-mode
>    1      lib-requires
>    1      lentic-org
>    1      lentic
>    1      highlight
>    1      helm-gitlab
>    1      helm-dirset
>    1      helm-aws
>    1      helm-ad
>    1      flycheck-tip
>    1      flycheck-rust
>    1      flycheck-ghcmod
>    1      flycheck-color-mode-line
>    1      flycheck-cask
>    1      fakir
>    1      evm
>    1      eval-in-repl
>    1      elnode-proxy
>    1      edts-debug
>    1      edts-code
>    1      ecukes-template
>    1      ecukes-reporter-magnars
>    1      ecukes-hooks
>    1      ecukes-byte-compile
>    1      ebib-keywords
>    1      dispass
>    1      dired-narrow
>    1      datomic-snippets
>    1      codesearch
>    1      clojure-quick-repls
>    1      cider-client
>    1      cider-classpath
>    1      cider-apropos
>    1      auto-package-update
>    1      angular-snippets
>    1      amd-mode
>    1      aggressive-fill-paragraph
>    1      ac-anaconda
>
>
> # Files using 'dash', sorted alphabetically
>
> File                             Usage(s)
> -----------------------------------------
> ac-anaconda                         1
> ace-jump-buffer                     3
> ag                                  5
> aggressive-fill-paragraph           1
> amd-mode                            1
> anaconda-mode                      18
> angular-snippets                    1
> ansi                                7
> auto-compile                        3
> auto-package-update                 1
> bbdb-csv-import                    13
> bibslurp                            3
> bog                                38
> bts                                15
> cake2                              33
> camcorder                           3
> cask                               34
> cask-cli                           10
> cdnjs                               3
> cider                               5
> cider-apropos                       1
> cider-classpath                     1
> cider-client                        1
> cider-eldoc                         2
> cider-grimoire                      2
> cider-interaction                  24
> cider-spy                          10
> cider-stacktrace                    7
> cider-test                          8
> cider-util                          2
> clj-refactor                       37
> clocker                             4
> clojure-quick-repls                 1
> codesearch                          1
> color-identifiers-mode             15
> color-moccur                        8
> commander                          17
> company-anaconda                    2
> company-tern                        8
> creds                               7
> dash-functional                    12
> date-field                          2
> datomic-snippets                    1
> decl                                5
> dired-filter                       28
> dired-hacks-utils                   7
> dired-narrow                        1
> dired-open                          5
> dired-ranger                       10
> dired-subtree                      29
> dispass                             1
> doremi-frm                          2
> ebib                                6
> ebib-keywords                       1
> ebib-utils                         10
> ecukes                              4
> ecukes-byte-compile                 1
> ecukes-cli                          4
> ecukes-core                         2
> ecukes-helpers                      7
> ecukes-hooks                        1
> ecukes-load                         4
> ecukes-parse                       11
> ecukes-reporter                    20
> ecukes-reporter-magnars             1
> ecukes-run                         21
> ecukes-steps                        2
> ecukes-template                     1
> edbi-django                         8
> edts-code                           1
> edts-debug                          1
> edts-navigate                       2
> edts-project                        6
> edts-xref                           4
> elmacro                            15
> elnode-proxy                        1
> elwm                                4
> emamux-ruby-test                    3
> emr                                10
> emr-c                              10
> emr-elisp                          74
> enh-ruby-mode                       2
> ensime-client                       2
> ensime-company                      2
> ensime-config                       5
> ert-modeline                       11
> ert-runner                          5
> esh-help                            4
> espuds                              4
> eval-in-repl                        1
> evil-visual-mark-mode               6
> evm                                 1
> eyebrowse                           7
> f                                  24
> fakir                               1
> flycheck                           38
> flycheck-cask                       1
> flycheck-color-mode-line            1
> flycheck-d-unittest                 2
> flycheck-ert                        3
> flycheck-ghcmod                     1
> flycheck-haskell                    3
> flycheck-mercury                    8
> flycheck-pos-tip                    2
> flycheck-rust                       1
> flycheck-tip                        1
> fsharp-mode-completion             13
> git                                 8
> gitlab-ui                           2
> gitlab-version                      2
> gnomenm                             2
> go-projectile                       2
> grass-mode                          5
> grunt                               2
> hamlet-mode                         2
> helm-ad                             1
> helm-aws                            1
> helm-bibtex                        21
> helm-dirset                         1
> helm-flycheck                       5
> helm-gitlab                         1
> helm-projectile                    10
> helm-projectile-all                 2
> highlight                           1
> httprepl                           12
> imgix                               5
> inf-fsharp-mode                     2
> interval-tree                       5
> ivs-edit                            2
> js2-refactor                        2
> js2r-functions                     36
> js2r-helpers                        4
> js2r-vars                           2
> jumblr                             22
> jvm-mode                            5
> keyset                             11
> lentic                              1
> lentic-asciidoc                     5
> lentic-block                        3
> lentic-org                          1
> lib-requires                        1
> litable                            11
> lxc                                 5
> m-buffer                           25
> magit-find-file                     2
> magma-scan                          3
> magma-smie                          2
> magnatune                          36
> maker-mode                          1
> malabar-ede-maven                   1
> malabar-import                      4
> malabar-mode                        6
> malabar-project                     5
> malabar-reflection                  6
> malabar-semanticdb                  1
> malabar-service                     2
> malabar-util                        2
> malinka                            22
> marcopolo-version                   1
> markdown-toc                        6
> marmalade-client                    2
> minitest                            4
> misc-cmds                           2
> multifiles                          6
> mustache-render                     3
> navorski                            4
> noflet                              3
> nrepl-client                       11
> nvm                                 6
> omnisharp                          13
> omnisharp-auto-complete-actions     3
> omnisharp-server-actions            3
> omnisharp-utils                     3
> op-export                           4
> org-drill-table                    12
> org-projectile                      1
> org-transform-tree-table            9
> org-trello                          1
> org-trello-action                   5
> org-trello-api                      1
> org-trello-backend                  4
> org-trello-buffer                  10
> org-trello-cbx                      3
> org-trello-controller              11
> org-trello-data                    10
> org-trello-entity                   1
> org-trello-hash                     2
> org-trello-proxy                    9
> org-trello-setup                    1
> org-trello-utils                    1
> orgit                               5
> orglink                             1
> origami                            49
> outline-magic                       2
> outshine                            2
> overseer                            1
> ox-pandoc                          17
> packed                             10
> pallet                              5
> paradox                             6
> pip-requirements                    2
> prodigy                            74
> projectile                        108
> projectile-rails                   15
> projmake-elmm                       1
> prosjekt                            2
> psci                                7
> py-test                             2
> quickref                            6
> rake                                3
> recompile-on-save                   2
> relative-buffers                    4
> replace-from-region                 1
> req-package                         7
> rswitcher                          12
> rubocop                             2
> scala-outline-popup                 5
> sclang-ac-mode                     12
> sclang-doc-mode                    18
> sclang-extensions                  10
> sclang-extensions-utils            11
> sclang-post-mode                    1
> servant                             3
> serverspec                          1
> shadchen                            3
> simplezen                           3
> skeletor                           40
> smart-mode-line                     7
> smartparens                       162
> smartparens-config                  1
> smartparens-html                    5
> solarized                           2
> sonic-pi-console                    1
> soundklaus                          6
> string-edit                         5
> tagedit                             1
> tbx2org                             1
> tco                                 3
> tern-django                         1
> thumb-frm                           3
> travis-utils                        1
> travis-version                      2
> tree-buffer                         2
> trident-mode                        1
> turnip                             30
> undercover                         10
> virtualenvwrapper                  21
> wacs-configuration                 13
> wacs-init                           1
> wacs-interactive                   20
> wacs-util                           4
> wand                                3
> web                                 4
> with-editor                         4
> with-namespace                      1
> wonderland                         18
> workgroups2                        23
> wrap-region                         7
> ycmd                                2
>
>
> ### End
>
>
> ###
> ### Usage of 's' by MELPA packages
> ###
>
> 's' is used by 161/4506 files (3.57%).
>
>
> # Function usage counts, sorted by decreasing frequency
>
> Count       %       Function
> -----------------------------------------
>  134      12.97     s-match
>  130      12.58     s-join
>  100       9.68     s-concat
>   84       8.13     s-split
>   77       7.45     s-matches
>   70       6.78     s-trim
>   67       6.49     s-starts
>   58       5.61     s-blank
>   55       5.32     s-chop
>   43       4.16     s-equals
>   36       3.48     s-replace
>   33       3.19     s-ends
>   23       2.23     s-contains
>   15       1.45     s-lines
>   13       1.26     s-format
>   11       1.06     s-prepend
>   11       1.06     s-append
>    9       0.87     s-repeat
>    9       0.87     s-lex
>    6       0.58     s-chomp
>    5       0.48     s-index
>    5       0.48     s-downcase
>    4       0.39     s-truncate
>    4       0.39     s-present
>    4       0.39     s-numeric
>    3       0.29     s-word
>    3       0.29     s-slice
>    3       0.29     s-shared
>    2       0.19     s-with
>    2       0.19     s-upcase
>    2       0.19     s-right
>    2       0.19     s-pad
>    2       0.19     s-lower
>    2       0.19     s-left
>    2       0.19     s-dashed
>    1       0.10     s-upper
>    1       0.10     s-snake
>    1       0.10     s-presence
>    1       0.10     s-capitalize
>    0       0.00     s-wrap
>    0       0.00     s-uppercase
>    0       0.00     s-titleized
>    0       0.00     s-titleize
>    0       0.00     s-reverse
>    0       0.00     s-mixedcase
>    0       0.00     s-lowercase
>    0       0.00     s-less
>    0       0.00     s-count
>    0       0.00     s-collapse
>    0       0.00     s-center
>    0       0.00     s-capitalized
>    0       0.00     s--truthy
>    0       0.00     s--mapcar
>    0       0.00     s--aget
>
>
> # Function usage counts, sorted by function name
>
> Function                       Count      %
> ---------------------------------------------
> s--aget                          0       0.00
> s--mapcar                        0       0.00
> s--truthy                        0       0.00
> s-append                        11       1.06
> s-blank                         58       5.61
> s-capitalize                     1       0.10
> s-capitalized                    0       0.00
> s-center                         0       0.00
> s-chomp                          6       0.58
> s-chop                          55       5.32
> s-collapse                       0       0.00
> s-concat                       100       9.68
> s-contains                      23       2.23
> s-count                          0       0.00
> s-dashed                         2       0.19
> s-downcase                       5       0.48
> s-ends                          33       3.19
> s-equals                        43       4.16
> s-format                        13       1.26
> s-index                          5       0.48
> s-join                         130      12.58
> s-left                           2       0.19
> s-less                           0       0.00
> s-lex                            9       0.87
> s-lines                         15       1.45
> s-lower                          2       0.19
> s-lowercase                      0       0.00
> s-match                        134      12.97
> s-matches                       77       7.45
> s-mixedcase                      0       0.00
> s-numeric                        4       0.39
> s-pad                            2       0.19
> s-prepend                       11       1.06
> s-presence                       1       0.10
> s-present                        4       0.39
> s-repeat                         9       0.87
> s-replace                       36       3.48
> s-reverse                        0       0.00
> s-right                          2       0.19
> s-shared                         3       0.29
> s-slice                          3       0.29
> s-snake                          1       0.10
> s-split                         84       8.13
> s-starts                        67       6.49
> s-titleize                       0       0.00
> s-titleized                      0       0.00
> s-trim                          70       6.78
> s-truncate                       4       0.39
> s-upcase                         2       0.19
> s-upper                          1       0.10
> s-uppercase                      0       0.00
> s-with                           2       0.19
> s-word                           3       0.29
> s-wrap                           0       0.00
>
>
> # Files using 's', sorted by usage count
>
> Usage(s)  File
> -----------------------------------------
>   70      clj-refactor
>   35      sclang-extensions-utils
>   35      projectile
>   32      malinka
>   32      ecukes-parse
>   31      emr-elisp
>   27      projectile-rails
>   27      commander
>   26      skeletor
>   26      list-packages-ext
>   24      helm-bibtex
>   22      turnip
>   20      cake2
>   18      weechat
>   18      sclang-ac-mode
>   18      melpa-upstream-visit
>   17      ecukes-reporter
>   16      fsharp-mode-completion
>   16      fountain-mode
>   15      virtualenvwrapper
>   14      prodigy
>   14      emr
>   13      sphinx-doc
>   13      mustache-lex
>   12      simplezen
>   10      soundklaus
>   10      org-trello-data
>   10      nvm
>   10      gotest
>    9      magnatune
>    9      magit-gh-pulls
>    9      httprepl
>    9      flycheck-mercury
>    9      espuds
>    9      ert-runner
>    9      emamux-ruby-test
>    8      sclang-post-mode
>    8      ecukes-run
>    7      weechat-relay
>    7      phpunit
>    7      org-trello-cbx
>    7      mustache-render
>    7      git
>    7      elmacro
>    7      cerbere-phpunit
>    6      web
>    6      org-drill-table
>    6      ecukes-cli
>    6      bibslurp
>    5      timesheet
>    5      marcopolo-utils
>    5      maker-mode
>    5      jumblr
>    5      ecukes
>    5      cask-cli
>    5      bts
>    5      ag
>    4      weechat-image
>    4      weechat-color
>    4      show-css
>    4      relative-buffers
>    4      mustache-parse
>    4      maven-test-mode
>    4      marcopolo-registry
>    4      imgix
>    4      helm-gitlab
>    4      helm-dirset
>    4      gradle-mode
>    4      f
>    4      emr-scheme
>    4      emr-c
>    4      cerbere-gotest
>    3      weechat-corrector
>    3      weechat-button
>    3      travis-utils
>    3      tagedit
>    3      sclang-doc-mode
>    3      psci
>    3      password-store
>    3      markdown-toc
>    3      marcopolo-mode
>    3      elmine
>    3      ecukes-steps
>    3      ecukes-load
>    3      crm-custom
>    3      company-ycmd
>    3      cake-inflector
>    3      buffer-combine
>    3      angular-snippets
>    2      weechat-tracking
>    2      weechat-spelling
>    2      weechat-cmd
>    2      wand
>    2      serverspec
>    2      s-buffer
>    2      org-trello-proxy
>    2      org-trello-buffer
>    2      navorski
>    2      marcopolo-hub
>    2      magma-interactive
>    2      helm-github-stars
>    2      hamlet-mode
>    2      goto-gem
>    2      gitlab-utils
>    2      gitlab-issues
>    2      gitlab-groups
>    2      fsharp-mode
>    2      ert-modeline
>    2      ensime-company
>    2      elnode-proxy
>    2      edbi-django
>    2      ecukes-reporter-landing
>    2      ecukes-core
>    2      company-tern
>    2      ansible
>    2      amd-mode
>    1      weechat-core
>    1      travis-repos
>    1      travis-mode
>    1      travis-builds
>    1      tbx2org
>    1      stock-ticker
>    1      signature-display
>    1      signature-backend
>    1      shelldoc
>    1      quickref
>    1      pallet
>    1      org-trello-utils
>    1      org-trello-setup
>    1      org-transform-tree-table
>    1      livid-mode
>    1      kurecolor
>    1      js2r-helpers
>    1      js2r-conditionals
>    1      http
>    1      hookify
>    1      helm-project-persist
>    1      helm-bm
>    1      helm-backup
>    1      gnomenm
>    1      gitlab-session
>    1      gitlab-projects
>    1      flycheck-tip
>    1      eyuml
>    1      evm
>    1      ensime-vars
>    1      ensime-mode
>    1      emr-prog
>    1      emr-lisp
>    1      elnode
>    1      ecukes-template
>    1      ecukes-reporter-progress
>    1      ecukes-new
>    1      ecukes-helpers
>    1      ecukes-def
>    1      eclim-completion
>    1      dollaro
>    1      dired-filter
>    1      creds
>    1      company-edbi
>    1      anaconda-mode
>
>
> # Files using 's', sorted alphabetically
>
> File                             Usage(s)
> -----------------------------------------
> ag                                  5
> amd-mode                            2
> anaconda-mode                       1
> angular-snippets                    3
> ansible                             2
> bibslurp                            6
> bts                                 5
> buffer-combine                      3
> cake-inflector                      3
> cake2                              20
> cask-cli                            5
> cerbere-gotest                      4
> cerbere-phpunit                     7
> clj-refactor                       70
> commander                          27
> company-edbi                        1
> company-tern                        2
> company-ycmd                        3
> creds                               1
> crm-custom                          3
> dired-filter                        1
> dollaro                             1
> eclim-completion                    1
> ecukes                              5
> ecukes-cli                          6
> ecukes-core                         2
> ecukes-def                          1
> ecukes-helpers                      1
> ecukes-load                         3
> ecukes-new                          1
> ecukes-parse                       32
> ecukes-reporter                    17
> ecukes-reporter-landing             2
> ecukes-reporter-progress            1
> ecukes-run                          8
> ecukes-steps                        3
> ecukes-template                     1
> edbi-django                         2
> elmacro                             7
> elmine                              3
> elnode                              1
> elnode-proxy                        2
> emamux-ruby-test                    9
> emr                                14
> emr-c                               4
> emr-elisp                          31
> emr-lisp                            1
> emr-prog                            1
> emr-scheme                          4
> ensime-company                      2
> ensime-mode                         1
> ensime-vars                         1
> ert-modeline                        2
> ert-runner                          9
> espuds                              9
> evm                                 1
> eyuml                               1
> f                                   4
> flycheck-mercury                    9
> flycheck-tip                        1
> fountain-mode                      16
> fsharp-mode                         2
> fsharp-mode-completion             16
> git                                 7
> gitlab-groups                       2
> gitlab-issues                       2
> gitlab-projects                     1
> gitlab-session                      1
> gitlab-utils                        2
> gnomenm                             1
> gotest                             10
> goto-gem                            2
> gradle-mode                         4
> hamlet-mode                         2
> helm-backup                         1
> helm-bibtex                        24
> helm-bm                             1
> helm-dirset                         4
> helm-github-stars                   2
> helm-gitlab                         4
> helm-project-persist                1
> hookify                             1
> http                                1
> httprepl                            9
> imgix                               4
> js2r-conditionals                   1
> js2r-helpers                        1
> jumblr                              5
> kurecolor                           1
> list-packages-ext                  26
> livid-mode                          1
> magit-gh-pulls                      9
> magma-interactive                   2
> magnatune                           9
> maker-mode                          5
> malinka                            32
> marcopolo-hub                       2
> marcopolo-mode                      3
> marcopolo-registry                  4
> marcopolo-utils                     5
> markdown-toc                        3
> maven-test-mode                     4
> melpa-upstream-visit               18
> mustache-lex                       13
> mustache-parse                      4
> mustache-render                     7
> navorski                            2
> nvm                                10
> org-drill-table                     6
> org-transform-tree-table            1
> org-trello-buffer                   2
> org-trello-cbx                      7
> org-trello-data                    10
> org-trello-proxy                    2
> org-trello-setup                    1
> org-trello-utils                    1
> pallet                              1
> password-store                      3
> phpunit                             7
> prodigy                            14
> projectile                         35
> projectile-rails                   27
> psci                                3
> quickref                            1
> relative-buffers                    4
> s-buffer                            2
> sclang-ac-mode                     18
> sclang-doc-mode                     3
> sclang-extensions-utils            35
> sclang-post-mode                    8
> serverspec                          2
> shelldoc                            1
> show-css                            4
> signature-backend                   1
> signature-display                   1
> simplezen                          12
> skeletor                           26
> soundklaus                         10
> sphinx-doc                         13
> stock-ticker                        1
> tagedit                             3
> tbx2org                             1
> timesheet                           5
> travis-builds                       1
> travis-mode                         1
> travis-repos                        1
> travis-utils                        3
> turnip                             22
> virtualenvwrapper                  15
> wand                                2
> web                                 6
> weechat                            18
> weechat-button                      3
> weechat-cmd                         2
> weechat-color                       4
> weechat-core                        1
> weechat-corrector                   3
> weechat-image                       4
> weechat-relay                       7
> weechat-spelling                    2
> weechat-tracking                    2
>
>
> ### End
>
>
> --- End results ---
>
>
>
> #+begin_src perl
>
>     #!/usr/bin/perl
>
>     ###
>     #
>     # The following script assumes the following commands have been
>     # run from a shell:
>     #
>     # $ git clone https://github.com/milkypostman/melpa
>     # $ cd melpa
>     # $ make all
>     # $ cd packages
>     # $ for i in *.tar; do tar xf $i; done
>     #
>     # The library being analysed is specified via
>     # the $util_package_name and $util_package_prefix
>     # variables.
>     #
>     # The value of $elpa_dir will probably need to be
>     # modified to reflect the location of the
>     # melpa/packages directory on your system.
>     #
>     ###
>
>
>     use strict;
>     use warnings;
>
>     use English;
>     use File::Find;
>
>
>     # -- Initialisations --
>
>     # Variables which can be set by the user.
>
>     my $elpa_dir = $ENV{HOME} . '/src/github/melpa/packages/';
>     my $util_package_name = 'dash';
>     # We can't simply generate this from $util_package_name
>     # because it would break on (at least) dash.el.
>     my $util_package_prefix = '-';
>
>     # Internal variables.
>
>     my $all_function_occurences = 0;
>     my $all_usage_occurences = 0;
>     my $count;
>     my $dh;
>     my $fh;
>     my $func;
>     my $package_count = 0;
>     my $package_element;
>     my $percentage;
>     my $usage_percentage = 0;
>
>     my @funcs_by_frequency;
>     my @funcs_by_name;
>     my @package_elements_by_usage_frequency;
>     my @package_elements_by_name;
>     my @packages;
>
>     my %files_using_util_package;
>     my %usages;
>     my %util_package_functions;
>
>
>     # -- Helper functions. --
>
>     sub extract_util_package_functions {
>
>         if (/^${util_package_name}(-\d{8}\.\d+)?\.el$/) {
>
>             my $f = $File::Find::name;
>             open($fh, '<', $f) || die "Couldn't open $f: $!";
>             while (<$fh>) {
>                 if (/\(defun (${util_package_prefix}-?[[:alnum:]]+)/
>                     || /\(defmacro (${util_package_prefix}-?[[:alnum:]]+)/) {
>                     $util_package_functions{$1} = 0;
>                 }
>             }
>
>         }
>     }
>
>     sub analyse_functions_usage {
>
>         if (/^([-[:alnum:]]+)(?:-\d{8}\.\d+)?\.el$/) {
>
>             my $package_element = $1;
>             my $filename = $_;
>
>             if ($package_element =~ /-pkg/) {
>                 return;
>             }
>             if ($filename =~ /^${util_package_name}-\d{8}\.\d+\.el$/) {
>                 return;
>             }
>
>             push @packages, $package_element;
>             $package_count++;
>             print "Analysing $package_element ....\n";
>
>             open($fh, '<', $File::Find::name) || die "Couldn't open 
> $File::Find::name: $!";
>             while (<$fh>) {            
>                 for my $key (keys %util_package_functions) {
>                     if (/\(${key}/) {
>                         $util_package_functions{$key}++;
>                         $usages{$package_element}++;
>                     }
>                 }
>             }
>             close $fh || die "Couldn't close $File::Find::name: $!";
>
>         }
>     }
>
>
>     # -- Processing --
>
>     find(\&extract_util_package_functions, ($elpa_dir));
>     finddepth(\&analyse_functions_usage, ($elpa_dir));
>
>
>     # -- Calculations --
>
>     $all_usage_occurences = scalar(keys %usages);
>     $usage_percentage = $all_usage_occurences / $package_count * 100;
>
>     for my $key (keys %util_package_functions) {
>         $all_function_occurences += $util_package_functions{$key};
>     }
>
>     for $func (sort keys %util_package_functions) {
>         $count = sprintf("%3u", $util_package_functions{$func});
>         $percentage = sprintf('%2.2f', ($util_package_functions{$func} / 
> $all_function_occurences * 100));
>         push @funcs_by_frequency, $count . "\t" . $percentage . "\t" . $func;
>         push @funcs_by_name, $func . "\t" . $count . "\t" . $percentage;
>     }
>
>     for $package_element (sort keys %usages) {
>         $count = sprintf("%3u", $usages{$package_element});
>         push @package_elements_by_usage_frequency, $count . "\t" . 
> $package_element;
>         push @package_elements_by_name, $package_element . "\t" . $count;
>     }
>
>
>     # -- Results --
>
>     $FORMAT_LINES_PER_PAGE = 999;
>     $OUTPUT_AUTOFLUSH = 1;
>
>     print "\n";
>     print "###\n";
>     print "### Usage of '$util_package_name' by MELPA packages\n";
>     print "###\n\n";
>     print "'$util_package_name' is used by 
> ${all_usage_occurences}/${package_count} files (" . sprintf("%2.2f", 
> $usage_percentage) . "%).\n\n\n";
>
>     print "# Function usage counts, sorted by decreasing frequency\n\n";
>
>     format Frequency_top =
>     Count       %       Function
>     -----------------------------------------
>     .
>
>     format Frequency =
>     @###     @##.##     @<<<<<<<<<<<<<<<<<<<<
>     $count, $percentage, $func
>     .
>
>     $FORMAT_LINES_LEFT = 0;
>     $FORMAT_TOP_NAME = 'Frequency_top';
>     $FORMAT_NAME = 'Frequency';
>     for my $elt (reverse sort @funcs_by_frequency) {
>         ($count, $percentage, $func) = split('\t', $elt);
>         write;
>     }
>
>     print "\n\n";
>     print "# Function usage counts, sorted by function name\n\n";
>
>     format Name_top =
>     Function                       Count      %
>     ---------------------------------------------
>     .
>
>     format Name =
>     @<<<<<<<<<<<<<<<<<<<<<<<<     @###     @##.##
>     $func, $count, $percentage
>     .
>
>     $FORMAT_LINES_LEFT = 0;
>     $FORMAT_TOP_NAME = 'Name_top';
>     $FORMAT_NAME = 'Name';
>     for my $elt (sort @funcs_by_name) {
>         ($func, $count, $percentage) = split('\t', $elt);
>         write;
>     }
>
>     print "\n\n";
>     print "# Files using '$util_package_name', sorted by usage count\n\n";
>
>     format File_usages_count_top =
>     Usage(s)  File                           
>     -----------------------------------------
>     .
>
>     format File_usages_count =
>     @###      @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>     $count, $package_element
>     .
>
>     $FORMAT_LINES_LEFT = 0;
>     $FORMAT_TOP_NAME = 'File_usages_count_top';
>     $FORMAT_NAME = 'File_usages_count';
>     for my $elt (reverse sort @package_elements_by_usage_frequency) {
>         ($count, $package_element) = split('\t', $elt);
>         write;
>     }
>
>     print "\n\n";
>     print "# Files using '$util_package_name', sorted alphabetically\n\n";
>
>     format File_usages_alphabetically_top =
>     File                             Usage(s)
>     -----------------------------------------
>     .
>
>     format File_usages_alphabetically =
>     @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<   @##
>     $package_element, $count
>     .
>
>     $FORMAT_LINES_LEFT = 0;
>     $FORMAT_TOP_NAME = 'File_usages_alphabetically_top';
>     $FORMAT_NAME = 'File_usages_alphabetically';
>     for my $elt (sort @package_elements_by_name) {
>         ($package_element, $count) = split('\t', $elt);
>         write;
>     }
>
>     print "\n\n";
>     print "### End\n\n";
>
> #+end_src
>
>
>
> Alexis.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]