Check for types in function parameters
This commit is contained in:
parent
008d5691d4
commit
f1bedd6c7c
1 changed files with 7 additions and 4 deletions
|
@ -6,14 +6,14 @@
|
||||||
(uiop:getcwd))))
|
(uiop:getcwd))))
|
||||||
|
|
||||||
(defun split-uri (uri)
|
(defun split-uri (uri)
|
||||||
|
(check-type uri string)
|
||||||
(remove-if #'string-empty-p
|
(remove-if #'string-empty-p
|
||||||
(uiop:split-string uri :separator "/")))
|
(uiop:split-string uri :separator "/")))
|
||||||
|
|
||||||
(defun valid-survey-id-p (id)
|
(defun valid-survey-id-p (id)
|
||||||
(member (if (stringp id)
|
(check-type id integer)
|
||||||
(parse-integer id)
|
(let ((ids (mapcar #'car (load-response (make-surveys-db-path)))))
|
||||||
id)
|
(if (member id ids) t nil)))
|
||||||
(mapcar #'car (load-response (make-surveys-db-path)))))
|
|
||||||
|
|
||||||
(defun today ()
|
(defun today ()
|
||||||
"Return today's date formatted as ISO-8601."
|
"Return today's date formatted as ISO-8601."
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
(make-db-path (today) "-surveys-db.lisp"))
|
(make-db-path (today) "-surveys-db.lisp"))
|
||||||
|
|
||||||
(defun load-response (db)
|
(defun load-response (db)
|
||||||
|
(check-type db string)
|
||||||
(with-open-file (stream db
|
(with-open-file (stream db
|
||||||
:direction :input
|
:direction :input
|
||||||
:if-does-not-exist :create)
|
:if-does-not-exist :create)
|
||||||
|
@ -42,6 +43,8 @@
|
||||||
(read stream))))
|
(read stream))))
|
||||||
|
|
||||||
(defun store-response (db responses)
|
(defun store-response (db responses)
|
||||||
|
(check-type db string)
|
||||||
|
(check-type responses list)
|
||||||
(with-open-file (stream db
|
(with-open-file (stream db
|
||||||
:direction :output
|
:direction :output
|
||||||
:if-exists :supersede)
|
:if-exists :supersede)
|
||||||
|
|
Loading…
Add table
Reference in a new issue