Commits

Anonymous committed 190e642

Remove useless requirement, rename write-tuple to write-vector.

Comments (0)

Files changed (1)

 (module encode scheme
-  (require rnrs/bytevectors-6)
   (require "types.ss")
   
   (define (write-1 byte)
             (for-each (lambda (x) (write-any-raw x)) data)
             (write-1 NIL)]))
   
-  (define (write-tuple data)
+  (define (write-vector data)
     (let ([len (vector-length data)])
       (if (< len 256)
           (begin
           (begin
             (write-1 LARGE_TUPLE)
             (write-4 len)))
-      (let vector-for-each ([position 0])
+      (let vector-do ([position 0])
         (unless (= position len)
           (begin
             (write-any-raw (vector-ref data position))
-            (vector-for-each (+ position 1)))))))
+            (vector-do (+ position 1)))))))
   
   (define (write-fixnum num)
     (cond
       [(integer? obj)
        (write-fixnum obj)]
       [(vector? obj)
-       (write-tuple obj)]
+       (write-vector obj)]
       [else (error "write-any-raw: Not implemented.")]))
   
   (define (write-any obj)
     (with-output-to-bytes (lambda() (write-any obj))))
   
   (define (encode-pretty obj)
-    (bytevector->u8-list (encode obj)))
+    (bytes->list (encode obj)))
   
   (define (test)
     ; {foo,42,666,{12,[],{255,'Bar'},111222333444555666}}