Hello!

I've been playing around with some R7RS things, and noticed that MIT/GNU
Scheme has most of R7RS, but a few things are still missing (see also
https://github.com/ecraven/r7rs-coverage).

One of the simpler things might be bytevectors, if they are just aliased
to vector-8bs/strings, as the code in the attachment does. This does
*not* add un/parser support for #u8...

Would this be acceptable for inclusion into master?

Also missing and maybe not too hard:
- exact-integer-sqrt
- (log x y)
- nan?
- finite?
- infinite?
- #\alarm
- call/cc as an alias
- symbol=?

Missing but maybe harder?:
- string-foldcase
- all string/char comparison with more than two parameters
- vector-map and vector-for-each on different length vectors
- digit-value

Thanks for any help, greetings!

Peter
;; simple aliasing "implementation" of r7rs bytevectors
;; just map everything to vector-8b / string

(define bytevector? string?)

(define (make-bytevector k #!optional byte)
  (if (default-object? byte)
      (make-vector-8b k)
      (make-vector-8b k byte)))

(define (bytevector . rest)
  (list->string (map integer->char rest)))

(define bytevector-length vector-8b-length)

(define bytevector-u8-ref vector-8b-ref)

(define bytevector-u8-set! vector-8b-set!)

(define (bytevector-copy bytevector #!optional start end)
  (string-copy bytevector start end))

(define (bytevector-copy! to at from #!optional start end)
  (string-copy! to at from start end))

(define bytevector-append string-append)

;; if it is a utf8 "bytevector", it is already a string
(define utf8->string identity-procedure)

;; if it is a string that is supposed to contain utf8, it is already a 
"bytevector"
(define string->utf8 identity-procedure)
_______________________________________________
MIT-Scheme-devel mailing list
MIT-Scheme-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/mit-scheme-devel

Reply via email to