Temporarily disable code that creates circular deps
After attempting to package some of my Elisp libraries using Nix, I exposed circular dependencies between modules that has existed for awhile. I'm temporarily disabling this code since I do not have time to refactor everything. When I get around to packaging everything, I'll need to resolve these issues. For now, I must carry on.
This commit is contained in:
parent
6b456c1b7a
commit
b3342afbfa
3 changed files with 38 additions and 26 deletions
|
@ -49,7 +49,9 @@
|
|||
;; Dependencies
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(require 'prelude)
|
||||
;; TODO: Move `prelude/assert' elsewhere so that I can require it without
|
||||
;; introducing the circular dependency of list.el -> prelude.el -> list.el.
|
||||
;;(require 'prelude)
|
||||
(require 'dash)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -179,19 +181,19 @@ Be leery of using this with things like alists. Many data structures in Elisp
|
|||
;; Tests
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(when list/tests?
|
||||
(prelude/assert
|
||||
(= 0
|
||||
(list/length '())))
|
||||
(prelude/assert
|
||||
(= 5
|
||||
(list/length '(1 2 3 4 5))))
|
||||
(prelude/assert
|
||||
(= 16
|
||||
(list/reduce 1 (lambda (x acc) (+ x acc)) '(1 2 3 4 5))))
|
||||
(prelude/assert
|
||||
(equal '(2 4 6 8 10)
|
||||
(list/map (lambda (x) (* x 2)) '(1 2 3 4 5)))))
|
||||
;; (when list/tests?
|
||||
;; (prelude/assert
|
||||
;; (= 0
|
||||
;; (list/length '())))
|
||||
;; (prelude/assert
|
||||
;; (= 5
|
||||
;; (list/length '(1 2 3 4 5))))
|
||||
;; (prelude/assert
|
||||
;; (= 16
|
||||
;; (list/reduce 1 (lambda (x acc) (+ x acc)) '(1 2 3 4 5))))
|
||||
;; (prelude/assert
|
||||
;; (equal '(2 4 6 8 10)
|
||||
;; (list/map (lambda (x) (* x 2)) '(1 2 3 4 5)))))
|
||||
|
||||
(provide 'list)
|
||||
;;; list.el ends here
|
||||
|
|
|
@ -106,16 +106,18 @@ While this function is undeniably trivial, I have unintentionally done (- 1 x)
|
|||
|
||||
;; TODO: Does this belong in a math module? Is math too vague? Or is number
|
||||
;; too vague?
|
||||
(defun number/factorial (x)
|
||||
"Return factorial of `X'."
|
||||
(cond
|
||||
((number/negative? x) (error "Will not take factorial of negative numbers"))
|
||||
((= 0 x) 1)
|
||||
;; NOTE: Using `series/range' introduces a circular dependency because:
|
||||
;; series -> number -> series. Conceptually, however, this should be
|
||||
;; perfectly acceptable.
|
||||
(t (->> (series/range 1 x)
|
||||
(list/reduce 1 #'*)))))
|
||||
;; TODO: Resolve the circular dependency that this introduces with series.el,
|
||||
;; and then re-enable this function and its tests below.
|
||||
;; (defun number/factorial (x)
|
||||
;; "Return factorial of `X'."
|
||||
;; (cond
|
||||
;; ((number/negative? x) (error "Will not take factorial of negative numbers"))
|
||||
;; ((= 0 x) 1)
|
||||
;; ;; NOTE: Using `series/range' introduces a circular dependency because:
|
||||
;; ;; series -> number -> series. Conceptually, however, this should be
|
||||
;; ;; perfectly acceptable.
|
||||
;; (t (->> (series/range 1 x)
|
||||
;; (list/reduce 1 #'*)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Tests
|
||||
|
@ -132,8 +134,8 @@ While this function is undeniably trivial, I have unintentionally done (- 1 x)
|
|||
(number/whole? 0))
|
||||
(prelude/assert
|
||||
(number/integer? 10))
|
||||
(prelude/assert
|
||||
(= 120 (number/factorial 5)))
|
||||
;; (prelude/assert
|
||||
;; (= 120 (number/factorial 5)))
|
||||
(prelude/assert
|
||||
(number/even? 6))
|
||||
(prelude/refute
|
||||
|
|
|
@ -18,8 +18,16 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Dependencies
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(require 'number)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Library
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun series/range (beg end)
|
||||
"Create a list of numbers from `BEG' to `END'.
|
||||
This is an inclusive number range."
|
||||
|
|
Loading…
Reference in a new issue