data-structure.scm excertp added by siiky on Thu Mar 7 19:36:06 2024

(define (##sys#substring=? s1 s2 start1 start2 n)
  (##sys#check-string s1 'substring=?)
  (##sys#check-string s2 'substring=?)
  (let ((len (or n  ; n may be greater than the strings' length
		 (fxmin (fx- (##sys#size s1) start1) ; start1 may be greater than s1's length
			(fx- (##sys#size s2) start2) ) ) ) ) ; same ^ for start2 and s2
    (##sys#check-fixnum start1 'substring=?) ; shouldn't these checks come before the let?
    (##sys#check-fixnum start2 'substring=?)
    (##core#inline "C_substring_compare" s1 s2 start1 start2 len) ) ) ; at this point len may be larger than 

(define (substring=? s1 s2 #!optional (start1 0) (start2 0) len)
  (##sys#substring=? s1 s2 start1 start2 len) )