(in-package #:lolicore) (defmacro make-ratings ((safe questionable explicit)) `(quote (("s" . ,safe) ("q" . ,questionable) ("e" . ,explicit)))) (defvar ratings-full-words '(("s" . "safe") ("q" . "questionable") ("e" . "explicit"))) (defclass booru () ((name :initarg :name :reader :name) (url :initarg :url :reader url) (rating-table :initarg :rating-table :reader rating-table) (rating-posts :initarg :rating-posts :reader rating-posts)) (:default-initargs :url (error "Need a URL") :rating-table '(("s" . "s") ("q" . "q") ("e" . "e")) :rating-posts (error "Need number of posts per rating"))) (defmethod get-rating ((obj booru) rating) (cdr (assoc rating (rating-table obj) :test 'string=))) (defmethod get-posts ((obj booru) rating) (cdr (assoc rating (rating-posts obj) :test 'string=)))