mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-30 15:00:21 +02:00
More read micro-optimizations
* module/ice-9/read.scm (read): Use R5RS read-char, peek-char, write-char rather than (ice-9 textual-ports) wrappers, because the latter are expressed in terms of the former.
This commit is contained in:
parent
5cd28ae0ac
commit
beac6a3e29
1 changed files with 3 additions and 3 deletions
|
@ -130,14 +130,14 @@
|
||||||
(define (curly-infix?) (enabled? bitfield:curly-infix?))
|
(define (curly-infix?) (enabled? bitfield:curly-infix?))
|
||||||
(define (r7rs-symbols?) (enabled? bitfield:r7rs-symbols?))
|
(define (r7rs-symbols?) (enabled? bitfield:r7rs-symbols?))
|
||||||
(define neoteric 0)
|
(define neoteric 0)
|
||||||
(define (next) (get-char port))
|
(define (next) (read-char port))
|
||||||
(define (peek) (lookahead-char port))
|
(define (peek) (peek-char port))
|
||||||
(define filename (port-filename port))
|
(define filename (port-filename port))
|
||||||
(define (get-pos) (cons (port-line port) (port-column port)))
|
(define (get-pos) (cons (port-line port) (port-column port)))
|
||||||
(define accumulator (open-output-string))
|
(define accumulator (open-output-string))
|
||||||
(define-syntax-rule (accumulate proc)
|
(define-syntax-rule (accumulate proc)
|
||||||
(begin
|
(begin
|
||||||
(proc (lambda (ch) (put-char accumulator ch)))
|
(proc (lambda (ch) (write-char ch accumulator)))
|
||||||
(let ((str (get-output-string accumulator)))
|
(let ((str (get-output-string accumulator)))
|
||||||
(seek accumulator 0 SEEK_SET)
|
(seek accumulator 0 SEEK_SET)
|
||||||
(truncate-file accumulator 0)
|
(truncate-file accumulator 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue