git.fiddlerwoaroof.com
Browse code

(init)

Ed Langley authored on 29/10/2020 23:36:09
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,27 @@
1
+;;; -*- Mode:Lisp; Syntax:ANSI-Common-Lisp; Package: ASDF-USER -*-
2
+(in-package :asdf-user)
3
+
4
+(defsystem :prune-datelist 
5
+  :description ""
6
+  :author "Ed L <edward@elangley.org>"
7
+  :license "MIT"
8
+  :depends-on (#:alexandria
9
+               #:uiop
10
+               #:serapeum
11
+               #:fwoar-lisputils
12
+               #:local-time)
13
+  :serial t
14
+  :in-order-to ((test-op (test-op :prune-datelist/tests)))
15
+  :components ((:file "prune-datelist")))
16
+
17
+(defsystem :prune-datelist/tests 
18
+  :description ""
19
+  :author "Ed L <edward@elangley.org>"
20
+  :license "MIT"
21
+  :depends-on (#:alexandria
22
+               #:uiop
23
+               #:serapeum
24
+               #:fiveam
25
+               #:prune-datelist)
26
+  :serial t
27
+  :components ((:file "tests")))
0 28
new file mode 100644
... ...
@@ -0,0 +1,22 @@
1
+(defpackage :prune-datelist
2
+  (:use :cl :alexandria :serapeum :fw.lu)
3
+  (:export #:main
4
+           #:prune-datelist))
5
+(in-package :prune-datelist)
6
+
7
+(defun mappend-history (fun list)
8
+  (loop
9
+     for prev = nil then (cons cur prev)
10
+     for cur on list
11
+     append (funcall fun prev (car cur) (cdr cur))))
12
+
13
+(defun map-longest ()
14
+  remove-from-plist)
15
+
16
+(defun prune-datelist (dates period)
17
+  (let ((parsed-dates (mapcar (op (local-time:parse-timestring _))
18
+                              dates)))
19
+    ()))
20
+
21
+(defun main (args)
22
+  )
0 23
new file mode 100644
... ...
@@ -0,0 +1,18 @@
1
+(defpackage :prune-datelist.tests
2
+  (:use :cl :alexandria :serapeum :fw.lu :5am)
3
+  (:export))
4
+(in-package :prune-datelist.tests)
5
+
6
+(def-suite :prune-datelist)
7
+(in-suite :prune-datelist)
8
+
9
+(test prune-datelist
10
+  (is (equal '("2017-01-01" "2017-01-08" "2017-01-15" "2017-01-22" "2017-01-29")
11
+             (prune-datelist:prune-datelist
12
+              '("2017-01-01" "2017-01-02" "2017-01-03" "2017-01-04" "2017-01-05" "2017-01-06"
13
+                "2017-01-07" "2017-01-08" "2017-01-09" "2017-01-10" "2017-01-11" "2017-01-12"
14
+                "2017-01-13" "2017-01-14" "2017-01-15" "2017-01-16" "2017-01-17" "2017-01-18"
15
+                "2017-01-19" "2017-01-20" "2017-01-21" "2017-01-22" "2017-01-23" "2017-01-24"
16
+                "2017-01-25" "2017-01-26" "2017-01-27" "2017-01-28" "2017-01-29" "2017-01-30")
17
+              :weekly))))
18
+