Browse code
bug: remove last bits of serapeum dep, fix lexical-compare
Showing 3 changed files
... | ... |
@@ -14,12 +14,12 @@ |
14 | 14 |
#:cl-containers |
15 | 15 |
#:closer-mop |
16 | 16 |
#:iterate |
17 |
- #:fwoar-lisputils/patmatch |
|
17 |
+ (:feature (:not (:or :ecl :abcl)) |
|
18 |
+ #:fwoar-lisputils/patmatch) |
|
18 | 19 |
#:fwoar-lisputils/string-utils |
19 | 20 |
#:plump |
20 | 21 |
#:positional-lambda |
21 |
- (:feature (:not (:or :ecl :abcl)) |
|
22 |
- #:fwoar-lisputils/implementation-dependent)) |
|
22 |
+ #:fwoar-lisputils/lexical-compare) |
|
23 | 23 |
:components ((:file "package") |
24 | 24 |
(:file "fwoar-lisputils") |
25 | 25 |
(:file "clos-helpers") |
... | ... |
@@ -33,16 +33,15 @@ |
33 | 33 |
(:file "glambda") |
34 | 34 |
(:file "misc"))) |
35 | 35 |
|
36 |
-(defsystem :fwoar-lisputils/implementation-dependent |
|
36 |
+(defsystem :fwoar-lisputils/lexical-compare |
|
37 | 37 |
:description "Utilities that don't work on every system" |
38 | 38 |
:author "fiddlerwoaroof <fiddlerwoaroof@gmail.com" |
39 | 39 |
:license "MIT" |
40 | 40 |
:serial t |
41 |
- :depends-on (#:serapeum |
|
42 |
- #:should-test) |
|
43 |
- :components ((:file "lexical-compare" :if-feature (:not (:or :ecl :abcl))))) |
|
41 |
+ :depends-on () |
|
42 |
+ :components ((:file "lexical-compare"))) |
|
44 | 43 |
|
45 |
-(defsystem :fwoar-lisputils/patmatch |
|
44 |
+(defsystem :fwoar-lisputils/patmatch |
|
46 | 45 |
:description "" |
47 | 46 |
:author "Ed L <edward@elangley.org>" |
48 | 47 |
:license "MIT" |
... | ... |
@@ -38,6 +38,7 @@ |
38 | 38 |
(:method ((a string) (b string)) |
39 | 39 |
(string= a b))) |
40 | 40 |
|
41 |
+#+(or) |
|
41 | 42 |
(st:deftest test-parse-mixed-string () |
42 | 43 |
(st:should be equal |
43 | 44 |
(list) |
... | ... |
@@ -64,10 +65,14 @@ |
64 | 65 |
(apply 'apply fun args))) |
65 | 66 |
|
66 | 67 |
(defun lexi-compare (a b &optional (elem-compare 'part<)) |
67 |
- (apply-when elem-compare |
|
68 |
- (car |
|
69 |
- (serapeum:drop-while (serapeum:op (apply 'part= _1)) |
|
70 |
- (mapcar 'list a b))))) |
|
68 |
+ (let* ((mismatch-pos (mismatch a b :test 'part=)) |
|
69 |
+ (a-tail (when mismatch-pos (nthcdr mismatch-pos a))) |
|
70 |
+ (b-tail (when mismatch-pos (nthcdr mismatch-pos b)))) |
|
71 |
+ (or (when (and a-tail b-tail) |
|
72 |
+ (funcall elem-compare |
|
73 |
+ (car a-tail) |
|
74 |
+ (car b-tail))) |
|
75 |
+ (null a-tail)))) |
|
71 | 76 |
|
72 | 77 |
(defun natural-sort-strings (a b) |
73 | 78 |
(lexi-compare (parse-mixed-string a) |
... | ... |
@@ -18,8 +18,6 @@ |
18 | 18 |
(:use #:cl #:alexandria) |
19 | 19 |
(:nicknames #:fw.lu) |
20 | 20 |
(:shadow #:with) |
21 |
- (:import-from #:fwoar.anonymous-gf #:glambda) |
|
22 |
- (:import-from #:patmatch #:let-pat*) |
|
23 | 21 |
(:export #:lambda-if #:lambda-cond #:alambda #:rollup-list |
24 | 22 |
#:ensure-mapping #:alist-string-hash-table #:make-pairs |
25 | 23 |
#:copy-slots #:transform-alist #:%json-pair-transform |
... | ... |
@@ -29,8 +27,8 @@ |
29 | 27 |
#:neither-null #:m-lambda #:sets #:defparameters #:setfs |
30 | 28 |
#:prog1-let #:prog1-bind #:if-let* #:with #:aconsf #:pick |
31 | 29 |
#:vector-destructuring-bind #:with-accessors* #:skip-values |
32 |
- #:limit-values #:substitute-values #:op #:pick/r |
|
33 |
- #:pick-error #:twice #:glambda #:default-unless |
|
30 |
+ #:limit-values #:substitute-values #:pick/r |
|
31 |
+ #:pick-error #:twice #:default-unless |
|
34 | 32 |
#:transform-first-value #:may #:defun-ct |
35 | 33 |
#:define-cluser-entrypoint #:new #:make-constructor #:dive |
36 | 34 |
#:empty-hash-table-like #:v-assoc #:defclass+)) |