lib/stringprimitive-struct.ss
#lang scheme/base

(require (planet chongkai/sml/ml-package)
         (only-in srfi/13 string-fill!))

(provide stringprimitive-struct)

(define-package stringprimitive-struct (sub_ mkstring_ blit_ set_nth_ fill_)
  
  (define ((sub_ s) i)
    (string-ref s i))
  
  (define mkstring_ make-string)
  
  (define (((((blit_ s1) o1) s2) o2) len)
    (string-copy! s2 o2 s1 o1 (+ o1 len)))
  
  (define (((set_nth_ s) i) c)
    (string-set! s i c))
  
  (define ((((fill_ str) start) len) chr)
    (string-fill! str chr start (+ start len))))