initial commit
This commit is contained in:
18
utils.lisp
Normal file
18
utils.lisp
Normal file
@@ -0,0 +1,18 @@
|
||||
(defpackage :lispostory
|
||||
(:use cl))
|
||||
|
||||
(in-package :lispostory)
|
||||
|
||||
(defun http-get-json (url)
|
||||
(multiple-value-bind (body status) (drakma:http-request url)
|
||||
(if (/= status 200)
|
||||
nil
|
||||
(let ((body-str (flexi-streams:octets-to-string body)))
|
||||
(shasht:read-json body-str)))))
|
||||
|
||||
(defun alist (&rest pairs)
|
||||
(loop for (key value) on pairs by #'cddr
|
||||
collect (cons key value)))
|
||||
|
||||
(defun map-vector (func vec)
|
||||
(map 'vector func vec))
|
||||
Reference in New Issue
Block a user