Fix a macro problem in "racket/private/string.rkt".
`port-success-k' is used in a single place, and instead of a simple `lambda' expression it was used with (and ... (lambda ...)), which lead to duplication of code. Instead, move the question into the `regexp-loop' macro. (The compiled zo file is indeed smaller after this change.)
This commit is contained in:
parent
14084d560d
commit
f538c2e076
|
@ -229,7 +229,7 @@
|
||||||
(let* ([mstart (caar m)]
|
(let* ([mstart (caar m)]
|
||||||
[mend (cdar m)]
|
[mend (cdar m)]
|
||||||
[0-ok? (not (= mstart mend))])
|
[0-ok? (not (= mstart mend))])
|
||||||
(if port-success-k
|
(if (and port-success-k (input-port? string))
|
||||||
(port-success-k
|
(port-success-k
|
||||||
(lambda (acc new-start new-end)
|
(lambda (acc new-start new-end)
|
||||||
(loop acc new-start new-end ipre 0-ok?))
|
(loop acc new-start new-end ipre 0-ok?))
|
||||||
|
@ -247,12 +247,11 @@
|
||||||
;; port-success-k: need to shift index of rest as reading; cannot
|
;; port-success-k: need to shift index of rest as reading; cannot
|
||||||
;; do a tail call without adding another state variable to the
|
;; do a tail call without adding another state variable to the
|
||||||
;; regexp loop, so this remains inefficient
|
;; regexp loop, so this remains inefficient
|
||||||
(and (input-port? string)
|
(lambda (loop acc start end mstart mend)
|
||||||
(lambda (loop acc start end mstart mend)
|
(append (map (lambda (p)
|
||||||
(append (map (lambda (p)
|
(cons (+ mend (car p)) (+ mend (cdr p))))
|
||||||
(cons (+ mend (car p)) (+ mend (cdr p))))
|
(loop '() 0 (and end (- end mend))))
|
||||||
(loop '() 0 (and end (- end mend))))
|
(cons (cons mstart mend) acc)))
|
||||||
(cons (cons mstart mend) acc))))
|
|
||||||
;; other port functions: use string case
|
;; other port functions: use string case
|
||||||
#f #f
|
#f #f
|
||||||
;; flags
|
;; flags
|
||||||
|
|
Loading…
Reference in New Issue
Block a user