Skip to content

Commit

Permalink
Replace 'cond' by 'typecase' because it's more clear.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukamachi committed Sep 14, 2016
1 parent 36be477 commit 125eec2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/core/db.lisp
Expand Up @@ -112,26 +112,28 @@
:element-type (array-element-type results-array))))
(loop for x across darray
for i from 0
do (cond
((eq x :null)
do (typecase x
((eql :null)
(setf (aref darray i) nil))
((consp x)
(cons
(setf (aref darray i)
(list-convert-nulls-to-nils x)))
((vectorp x)
((and (not string) vector)
(setf (aref darray i)
(array-convert-nulls-to-nils x)))))
results-array))

(defun list-convert-nulls-to-nils (results-list)
(mapcar (lambda (x)
(cond
((eq x :null) nil)
((consp x)
(typecase x
((eql :null)
nil)
(cons
(list-convert-nulls-to-nils x))
((vectorp x)
((and (not string) vector)
(array-convert-nulls-to-nils x))
(t x)))
(otherwise
x)))
results-list))

(defgeneric retrieve-by-sql (sql &key binds)
Expand Down

0 comments on commit 125eec2

Please sign in to comment.