string.scm 300 B

123456789
  1. (define (string-split regexp str)
  2. (let ((len (string-length str))
  3. (matches (list-matches regexp str)))
  4. (let ((starts (map match:start matches))
  5. (ends (map match:end matches)))
  6. (map (cut substring str <> <>)
  7. `(0 ,@ends)
  8. `(,@starts ,len)))))