Sha256: d8c78063de14ba6114ea77dca033be92b144829d5d60317ba1df1952af1fbc6a

Contents?: true

Size: 370 Bytes

Versions: 395

Compression:

Stored size: 370 Bytes

Contents

;;; word-count.el --- word-count Exercise (exercism)

;;; Commentary:

;;; Code:


(defun word-count (sentence)
  (let ((count nil))
    (dolist (i (split-string (downcase sentence) "[^a-z0-9]" t))
      (let ((n (assoc i count)))
        (if n (setcdr n (1+ (cdr n)))
          (push (cons i 1) count))))
    count))


(provide 'word-count)
;;; word-count.el ends here

Version data entries

395 entries across 395 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.179 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.178 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.177 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.176 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.175 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.174 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.173 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.172 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.171 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.170 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.169 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.167 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.166 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.165 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.164 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.163 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.162 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.161 tracks/elisp/exercises/word-count/example.el
trackler-2.2.1.160 tracks/elisp/exercises/word-count/example.el