Skip to content

Commit ece1fd9

Browse files
committed
Simpler snoc
1 parent 686c2ef commit ece1fd9

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

contents/graham_scan/code/elisp/graham-scan.el

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
(require 'cl-seq)
22

3-
(defun -concat (&rest lists)
4-
"Return a new list with the concatenation of the elements in the supplied LISTS."
5-
(declare (pure t) (side-effect-free t))
6-
(apply 'append lists))
7-
8-
(defun -snoc (list elem &rest elements)
3+
(defun snoc (list elem)
94
"Append ELEM to the end of the list.
105
116
This is like `cons', but operates on the end of list.
127
13-
If ELEMENTS is non nil, append these to the list as well."
14-
(-concat list (list elem) elements))
8+
Adapted from dash.el."
9+
(append list (list elem)))
1510

1611
(defun nthrev (n lst)
1712
"Return the Nth element of LST from the end."
@@ -39,7 +34,7 @@ If ELEMENTS is non nil, append these to the list as well."
3934
(dolist (point (cddr points))
4035
(while (not (is-ccw (nthrev 1 hull) (nthrev 0 hull) point))
4136
(setq hull (-remove-at (1- (length hull)) hull)))
42-
(setq hull (-snoc hull point)))
37+
(setq hull (snoc hull point)))
4338
hull))
4439

4540
(princ

0 commit comments

Comments
 (0)