Welcome to the CHICKEN Scheme pasting service

alist->ssql pasted by DerGuteMoritz on Sun Feb 10 13:49:28 2013

(define (alist->ssql-insert table alist)
  (cons `(insert (into ,table) 
                 (columns . ,(map car alist))
                 (values ,(list->vector
                           (list-tabulate (length alist) 
                                          (lambda (p) 
                                            (string->symbol (sprintf "$~A" (add1 p))))))))
        (map cdr alist)))

Usage added by DerGuteMoritz on Sun Feb 10 13:55:19 2013

(define (db-query conn statement #!optional (vars '()))
  (let ((sql (ssql->sql conn statement)))
    (query* conn sql vars)))

(let ((statement (alist->ssql 'users '((name . "foo") (email . "foo@bar") (age . 40)))))
  (apply db-query db-connection statement))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which egg provides `hash-table-ref'?
Visually impaired? Let me spell it for you (wav file) download WAV