Commits

Richo Healey committed 49fbcbd

list->alist is in the std library

Comments (0)

Files changed (4)

     (let ((user-data (redis-hgetall (string-append "user:" name))))
       (if (= 0 (length user-data))
         #f
-        (alist->json (list->alist user-data))))))
-
+        (alist->json (chop user-data) 2)))))

lib/util.scm

-(define list->alist
-  (lambda (lst)
-    (letrec ((process (lambda (items memo)
-                        (if (> 2 (length items))
-                          memo
-                          (process (cddr items) (alist-update (car items) (cadr items) memo))))))
-             (process lst (list)))))
-
-
-
 (use utils)
 ; (require-extension intarweb)
 
-(require "lib/util")
 (require "lib/json")
 
 ; Fetch our datastore

test/util.scm

-(test-begin "util")
-
-(test '((rawr . "foo") (something . 5))
-      (list->alist (list 'rawr "foo" 'something 5)))
-
-(test-end)