22 lines
547 B
Common Lisp
22 lines
547 B
Common Lisp
(defpackage :lispostory
|
|
(:use :cl :alexandria :serapeum))
|
|
|
|
(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))
|
|
|
|
(defun string-to-hash-table-key (s)
|
|
(string-replace " " s ""))
|