diff options
Diffstat (limited to 'gemini.cl')
-rw-r--r-- | gemini.cl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gemini.cl b/gemini.cl new file mode 100644 index 0000000..9460439 --- /dev/null +++ b/gemini.cl @@ -0,0 +1,26 @@ +(defun reverse-alist (alist) + (loop for (a . b) in alist collect `(,b . ,a))) + +(defvar +status-codes+ + '((10 . :input) + (11 . :sensitive-input) + (20 . :success) + (30 . :redirect) + (40 . :temporary-failure) + (41 . :server-unavailable) + (42 . :gci-error) + (43 . :proxy-error) + (44 . :slow-down) + (50 . :permanent-failure) + (51 . :not-found) + (52 . :gone) + (59 . :bad-request) + (60 . :client-certificate-required) + (61 . :certificate-not-authorised) + (62 . :certificate-not-valid))) + +(defun number->status (num) + (cdr (assoc num +status-codes+))) + +(defun status->number (key) + (cdr (assoc key (reverse-alist +status-codes+)))) |