Redefine >> macro as >-> in >.el
I created a strangely named Elisp module, >.el, just to appease the CI gods. My gut tells me that this is a desperate idea and fails the smell test. I'm pretty eager to pass the linting phase of my Elisp CI, however, and I can always revert this.
This commit is contained in:
parent
718899c629
commit
75a9a156a0
8 changed files with 53 additions and 26 deletions
|
|
@ -18,14 +18,19 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'list)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Dependencies
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(cl-defstruct stack xs)
|
||||
(require 'list)
|
||||
(require '>)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Create
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(cl-defstruct stack xs)
|
||||
|
||||
(defun stack-new ()
|
||||
"Create an empty stack."
|
||||
(make-stack :xs '()))
|
||||
|
|
@ -52,7 +57,7 @@
|
|||
"Push `X' on `XS'."
|
||||
(struct-update stack
|
||||
xs
|
||||
(>> (list-cons x))
|
||||
(>-> (list-cons x))
|
||||
xs))
|
||||
|
||||
;; TODO: How to return something like {(list-head xs), (list-tail xs)} in Elixir
|
||||
|
|
@ -63,7 +68,7 @@ Since I cannot figure out a nice way of return tuples in Elisp, if you want to
|
|||
look at the first element, use `stack-peek' before running `stack-pop'."
|
||||
(struct-update stack
|
||||
xs
|
||||
(>> list-tail)
|
||||
(>-> list-tail)
|
||||
xs))
|
||||
|
||||
(defun stack-map-top (f xs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue