diff options
Diffstat (limited to 'mpd.scm')
-rw-r--r-- | mpd.scm | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +(define-structure mpd (export query) + (open scheme-with-scsh) + (begin + (define-syntax query + (syntax-rules () + ((_ a) + (mpd-query-1 `a)))) + + (define (mpd-query-equals params) + (apply format #f "~s == ~s" params)) + + (define (mpd-query-and params) + (format #f "~a AND ~a" + (mpd-query-1 (car params)) + (mpd-query-1 (cadr params)))) + + (define (mpd-query-1 query) + (format #f "(~a)" + (let ((op (car query))) + (case op + ('= (mpd-query-equals (cdr query))) + ('and (mpd-query-and (cdr query))))))))) |