Browse code
finish pattern matcherrrrrrr
fiddlerwoaroof authored on 21/09/2017 21:36:50
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -30,3 +30,17 @@ |
30 | 30 |
`((,val-sym ,form) |
31 | 31 |
,@binders)))) |
32 | 32 |
|
33 |
+(defmethod handle-pattern append ((pattern item) form &rest args) |
|
34 |
+ (let ((key->reader '((:author . author) |
|
35 |
+ (:content . content) |
|
36 |
+ (:date . date) |
|
37 |
+ (:id . id) |
|
38 |
+ (:links . links)))) |
|
39 |
+ (let* ((val-sym (gensym "VAL")) |
|
40 |
+ (binders (loop for (key binding) on args by #'cddr |
|
41 |
+ for accessor = (cdr (assoc key key->reader)) |
|
42 |
+ when accessor append |
|
43 |
+ `((,binding (,accessor ,val-sym)))))) |
|
44 |
+ `((,val-sym ,form) |
|
45 |
+ ,@binders)))) |
|
46 |
+ |