# HG changeset patch # User Steve Losh # Date 1597380027 14400 # Node ID 56f93a6f58b4856265014affa91372d2065809ff # Parent e524dd8f7940a62e25750dbbb8c49ebe92cb5150 Minor cleanup diff -r e524dd8f7940 -r 56f93a6f58b4 src/basic.lisp --- a/src/basic.lisp Fri Aug 14 00:17:21 2020 -0400 +++ b/src/basic.lisp Fri Aug 14 00:40:27 2020 -0400 @@ -95,6 +95,7 @@ :column (input-column input) :message (apply #'format nil format-string args))) + (defun incf-depth (input) (declare (type input input) (optimize (speed 3) (safety 1) (debug 1))) @@ -219,12 +220,6 @@ (e class input "expected separator ~S but got ~S" #\: ch)) (skip-whitespace input))) -(defun json-type-of (object) - (typecase object - (integer 'integer) - (float 'float) - (t (type-of object)))) - ;;;; Readers ------------------------------------------------------------------ (defgeneric read% (class contained-class input)) @@ -473,16 +468,15 @@ (etypecase class-designator (cons (destructuring-bind (head a &optional (b nil b?)) class-designator (ecase head - ; (vector foo) + ; e.g. (vector foo) ((hash-table vector) (progn (when b? (fail)) (list head (canonicalize-class-designator a)))) - ; (or null foo) - (or (progn - (unless b? (fail)) ; must have a second option - (when (eql 'null b) (rotatef a b)) ; sort a/b - (unless (eql 'null a) (fail)) ; no arbitrary ors - (list 'nullable (canonicalize-class-designator b))))))) + ; e.g. (or null foo) + (or (progn (unless b? (fail)) ; must have a second option + (when (eql 'null b) (rotatef a b)) ; sort a/b + (unless (eql 'null a) (fail)) ; no arbitrary ors + (list 'nullable (canonicalize-class-designator b))))))) (symbol (case class-designator (vector '(vector (t))) (hash-table '(hash-table (t))) @@ -508,8 +502,7 @@ (let ((*read-default-float-format* 'double-float) (*print-base* 10)) (etypecase stream - ((or stream (eql t)) (progn (print% object stream) - (values))) - (null (with-output-to-string (s) - (print% object s)))))) + (stream (print% object stream) (values)) + ((eql t) (print% object *standard-output*) (values)) + (null (with-output-to-string (s) (print% object s))))))