Changeset 26894 in project


Ignore:
Timestamp:
06/13/12 11:05:38 (9 years ago)
Author:
Ivan Raikov
Message:

9ML-toolkit: make sure string-search-positions is visible to other procedures in the repr module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/9ML-toolkit/trunk/repr.scm

    r25756 r26894  
    14051405;;; Substitute matching strings:
    14061406
     1407(define (string-search-positions rx str #!optional (start 0) (range (string-length str)))
     1408  (let ((n (string-length str)))
     1409    (and-let* ((m (irregex-search rx str start (min n (fx+ start range)))))
     1410      (let loop ((i (irregex-match-num-submatches m))
     1411                 (res '()))
     1412        (if (fx< i 0)
     1413            res
     1414            (loop (fx- i 1) (cons (list (irregex-match-start-index m i)
     1415                                        (irregex-match-end-index m i))
     1416                                  res)))))))
     1417
    14071418(define string-substitute
    14081419  (let ([substring substring]
     
    14741485
    14751486
    1476 (define (string-search-positions rx str #!optional (start 0) (range (string-length str)))
    1477   (let ((n (string-length str)))
    1478     (and-let* ((m (irregex-search rx str start (min n (fx+ start range)))))
    1479       (let loop ((i (irregex-match-num-submatches m))
    1480                  (res '()))
    1481         (if (fx< i 0)
    1482             res
    1483             (loop (fx- i 1) (cons (list (irregex-match-start-index m i)
    1484                                         (irregex-match-end-index m i))
    1485                                   res)))))))
    1486 
    14871487
    14881488)
Note: See TracChangeset for help on using the changeset viewer.