56f93a6f58b4

Minor cleanup
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 14 Aug 2020 00:40:27 -0400
parents e524dd8f7940
children 37cd2173940e
branches/tags (none)
files src/basic.lisp

Changes

--- 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))))))