Commits

Anonymous committed 8530943

Add support for boolean? and void?, converted to complex types.

  • Participants
  • Parent commits 190e642

Comments (0)

Files changed (1)

       [(integer? obj)
        (write-fixnum obj)]
       [(vector? obj)
-       (write-vector obj)]
+       (write-vector obj)]      
       [else (error "write-any-raw: Not implemented.")]))
   
   (define (write-any obj)
     (write-1 MAGIC)
     (write-any-raw obj))
   
+  (define (convert obj)
+    (cond
+      [(eq? obj #t)
+       (vector 'bert 'true)]
+      [(eq? obj #f)
+       (vector 'bert 'false)]
+      [(void? obj)
+       (vector 'bert 'nil)]
+      [else obj]))
+      
   (define (encode obj)
-    (with-output-to-bytes (lambda() (write-any obj))))
+    (with-output-to-bytes (lambda() (write-any (convert obj)))))
   
   (define (encode-pretty obj)
     (bytes->list (encode obj)))