From fb5ec068ddd50f6bce41c7a0bad45673db787940 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Tue, 1 Sep 2020 10:17:43 +0100 Subject: More Elisp linting This should cover most of the remaining linting errors. After this, I expect fewer than ten linting errors. --- emacs/.emacs.d/wpc/graph.el | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'emacs/.emacs.d/wpc/graph.el') 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 +;; 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) -- cgit 1.4.1