about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/glittershark/emacs.d/utils.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/users/glittershark/emacs.d/utils.el b/users/glittershark/emacs.d/utils.el
index c595b46ce258..1bfac3ca8b33 100644
--- a/users/glittershark/emacs.d/utils.el
+++ b/users/glittershark/emacs.d/utils.el
@@ -10,6 +10,15 @@
 (defun inc (x) "Returns x + 1" (+ 1 x))
 (defun dec (x) "Returns x - 1" (- x 1))
 
+(defun average (ns)
+  "Arithmetic mean of xs"
+  (if (null ns) nil
+    (/ (apply #'+ ns)
+       (length ns))))
+
+(comment
+ (average (list 1 2 3 4))
+ )
 
 ;;
 ;; Text editing utils