about summary refs log tree commit diff
path: root/emacs/.emacs.d/wpc/series.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-09-01T09·17+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-09-01T09·17+0100
commitfb5ec068ddd50f6bce41c7a0bad45673db787940 (patch)
tree19b4ff96983c08f451e7da5f58c95b8f6090ec84 /emacs/.emacs.d/wpc/series.el
parenta638e15c0dd14a25e6f032b08de5ee1575677497 (diff)
More Elisp linting
This should cover most of the remaining linting errors. After this, I expect
fewer than ten linting errors.
Diffstat (limited to 'emacs/.emacs.d/wpc/series.el')
-rw-r--r--emacs/.emacs.d/wpc/series.el52
1 files changed, 28 insertions, 24 deletions
diff --git a/emacs/.emacs.d/wpc/series.el b/emacs/.emacs.d/wpc/series.el
index 55e97f278984..00be03a976f0 100644
--- a/emacs/.emacs.d/wpc/series.el
+++ b/emacs/.emacs.d/wpc/series.el
@@ -1,5 +1,9 @@
 ;;; series.el --- Hosting common series of numbers -*- lexical-binding: t -*-
+
 ;; Author: William Carroll <wpcarro@gmail.com>
+;; Version: 0.0.1
+;; URL: https://git.wpcarro.dev/wpcarro/briefcase
+;; Package-Requires: ((emacs "24"))
 
 ;;; Commentary:
 ;; Encoding number series as I learn about them.
@@ -28,62 +32,62 @@
 ;; Library
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defun series/range (beg end)
+(defun series-range (beg end)
   "Create a list of numbers from `BEG' to `END'.
 This is an inclusive number range."
   (if (< end beg)
-      (list/reverse
+      (list-reverse
        (number-sequence end beg))
     (number-sequence beg end)))
 
-(defun series/fibonacci-number (i)
+(defun series-fibonacci-number (i)
   "Return the number in the fibonacci series at `I'."
   (cond
    ((= 0 i) 0)
    ((= 1 i) 1)
-   (t (+ (series/fibonacci-number (- i 1))
-         (series/fibonacci-number (- i 2))))))
+   (t (+ (series-fibonacci-number (- i 1))
+         (series-fibonacci-number (- i 2))))))
 
-(defun series/fibonacci (n)
+(defun series-fibonacci (n)
   "Return the first `N' numbers of the fibonaccci series starting at zero."
   (if (= 0 n)
       '()
-    (list/reverse
-     (list/cons (series/fibonacci-number (number/dec n))
-                (list/reverse
-                 (series/fibonacci (number/dec n)))))))
+    (list-reverse
+     (list-cons (series-fibonacci-number (number-dec n))
+                (list-reverse
+                 (series-fibonacci (number-dec n)))))))
 
 ;; TODO: Consider memoization.
-(defun series/triangular-number (i)
+(defun series-triangular-number (i)
   "Return the number in the triangular series at `I'."
   (if (= 0 i)
       0
-    (+ i (series/triangular-number (number/dec i)))))
+    (+ i (series-triangular-number (number-dec i)))))
 
 ;; TODO: Improve performance.
 ;; TODO: Consider creating a stream protocol with `stream/next' and implement
 ;; this using that.
-(defun series/triangular (n)
+(defun series-triangular (n)
   "Return the first `N' numbers of a triangular series starting at 0."
   (if (= 0 n)
       '()
-    (list/reverse
-     (list/cons (series/triangular-number (number/dec n))
-                (list/reverse
-                 (series/triangular (number/dec n)))))))
+    (list-reverse
+     (list-cons (series-triangular-number (number-dec n))
+                (list-reverse
+                 (series-triangular (number-dec n)))))))
 
-(defun series/catalan-number (i)
+(defun series-catalan-number (i)
   "Return the catalan number in the series at `I'."
   (if (= 0 i)
       1
-    (/ (number/factorial (* 2 i))
-       (* (number/factorial (number/inc i))
-          (number/factorial i)))))
+    (/ (number-factorial (* 2 i))
+       (* (number-factorial (number-inc i))
+          (number-factorial i)))))
 
-(defun series/catalan (n)
+(defun series-catalan (n)
   "Return the first `N' numbers in a catalan series."
-  (->> (series/range 0 (number/dec n))
-       (list/map #'series/catalan-number)))
+  (->> (series-range 0 (number-dec n))
+       (list-map #'series-catalan-number)))
 
 (provide 'series)
 ;;; series.el ends here