utf8 egg's utf8-srfi-13.scm pasted by siiky on Fri Mar 15 13:26:23 2024

(define (make-string-prefix-test proc)
  (lambda (s1 s2 . opt)
    (cond
     ((null? opt)
      (and (<= (string-length s1) (string-length s2)) (proc s1 s2))) ; <== this line
     (else
      (with-two-substring-offsets
       (lambda (s1 s2 start1 end1 start2 end2)
         (let ((s1-len (- end1 start1))
               (s2-len (- end2 start2)))
           (and (<= s1-len s2-len) (proc s1 s2 start1 start2 s1-len))))
       s1 s2 opt)))))

(define string-prefix? (make-string-prefix-test substring=?))
(define string-prefix-ci? (make-string-prefix-test substring-ci=?))

substring=? fix's regression? added by siiky on Fri Mar 15 13:27:22 2024

#;5> sub ; <TAB> here
Error: (substring=?) out of range
3
0
3

	Call history:

	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	
	utf8-srfi-13.scm:374: proc	  	<--