diff options
author | William Carroll <wpcarro@gmail.com> | 2020-09-01T09·17+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-09-01T09·17+0100 |
commit | fb5ec068ddd50f6bce41c7a0bad45673db787940 (patch) | |
tree | 19b4ff96983c08f451e7da5f58c95b8f6090ec84 /emacs/.emacs.d/wpc/graph.el | |
parent | a638e15c0dd14a25e6f032b08de5ee1575677497 (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/graph.el')
-rw-r--r-- | emacs/.emacs.d/wpc/graph.el | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/emacs/.emacs.d/wpc/graph.el b/emacs/.emacs.d/wpc/graph.el index 30ed8aabe6b6..9965622bb6d7 100644 --- a/emacs/.emacs.d/wpc/graph.el +++ b/emacs/.emacs.d/wpc/graph.el @@ -1,5 +1,9 @@ ;;; graph.el --- Working with in-memory graphs -*- lexical-binding: t -*- + ;; Author: William Carroll <wpcarro@gmail.com> +;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase +;; Package-Requires: ((emacs "24.3")) ;;; Commentary: ;; @@ -42,44 +46,44 @@ (cl-defstruct graph neighbors edges) ;; TODO: How do you find the starting point for a topo sort? -(defun graph/sort (xs) +(defun graph-sort (xs) "Return a topological sort of XS.") -(defun graph/from-edges (xs) +(defun graph-from-edges (xs) "Create a graph struct from the Edge List, XS. The user must pass in a valid Edge List since asserting on the shape of XS might be expensive." (make-graph :edges xs)) -(defun graph/from-neighbors (xs) +(defun graph-from-neighbors (xs) "Create a graph struct from a Neighbors Table, XS. The user must pass in a valid Neighbors Table since asserting on the shape of XS might be expensive." (make-graph :neighbors xs)) -(defun graph/instance? (xs) +(defun graph-instance? (xs) "Return t if XS is a graph struct." (graph-p xs)) ;; TODO: Model each of the mapping functions into an isomorphism. -(defun graph/edges->neighbors (xs) +(defun graph-edges->neighbors (xs) "Map Edge List, XS, into a Neighbors Table." - (prelude-assert (graph/instance? xs))) + (prelude-assert (graph-instance? xs))) -(defun graph/neighbors->edges (xs) +(defun graph-neighbors->edges (xs) "Map Neighbors Table, XS, into an Edge List." - (prelude-assert (graph/instance? xs))) + (prelude-assert (graph-instance? xs))) ;; Below are three different models of the same unweighted, directed graph. -(defvar graph/edges +(defvar graph-edges '((a . b) (a . c) (a . e) (b . c) (b . d) (c . e) (d . f) (e . d) (e . f))) -(defvar graph/neighbors +(defvar graph-neighbors ((a b c e) (b c d) (c e) |