Skip to content

Commit 425aa8e

Browse files
resyntax-ci[bot]rfindler
authored andcommitted
Fix 2 occurrences of let-to-define
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
1 parent 7b47364 commit 425aa8e

File tree

1 file changed

+29
-33
lines changed

1 file changed

+29
-33
lines changed

drracket-core-lib/drracket/private/syncheck-debug.rkt

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -122,40 +122,36 @@
122122
;; build-ht : stx -> hash-table
123123
;; the resulting hash-table maps from the each sub-object's to its syntax.
124124
(define (syntax-object->datum/ht stx)
125-
(let ([ht (make-hasheq)])
126-
(values (let loop ([stx stx])
127-
(let ([obj (syntax-e stx)])
128-
(cond
129-
[(list? obj)
130-
(let ([res (map loop obj)])
131-
(hash-set! ht res stx)
132-
res)]
133-
[(pair? obj)
134-
(let ([res (cons (loop (car obj))
135-
(loop (cdr obj)))])
136-
(hash-set! ht res stx)
137-
res)]
138-
[(vector? obj)
139-
(let ([res (list->vector (map loop (vector->list obj)))])
140-
(hash-set! ht res stx)
141-
res)]
142-
[else
143-
(let ([res (syntax->datum stx)])
144-
(hash-set! ht res stx)
145-
res)])))
146-
ht)))
125+
(define ht (make-hasheq))
126+
(values (let loop ([stx stx])
127+
(let ([obj (syntax-e stx)])
128+
(cond
129+
[(list? obj)
130+
(let ([res (map loop obj)])
131+
(hash-set! ht res stx)
132+
res)]
133+
[(pair? obj)
134+
(let ([res (cons (loop (car obj)) (loop (cdr obj)))])
135+
(hash-set! ht res stx)
136+
res)]
137+
[(vector? obj)
138+
(let ([res (list->vector (map loop (vector->list obj)))])
139+
(hash-set! ht res stx)
140+
res)]
141+
[else
142+
(let ([res (syntax->datum stx)])
143+
(hash-set! ht res stx)
144+
res)])))
145+
ht))
147146

148147
;; make-text-port : text -> port
149148
;; builds a port from a text object.
150149
(define (make-text-port text)
151-
(let-values ([(in out) (make-pipe)])
152-
(thread
153-
(λ ()
154-
(let loop ()
155-
(let ([c (read-char in)])
156-
(unless (eof-object? c)
157-
(send text insert (string c)
158-
(send text last-position)
159-
(send text last-position))
160-
(loop))))))
161-
out))
150+
(define-values (in out) (make-pipe))
151+
(thread (λ ()
152+
(let loop ()
153+
(let ([c (read-char in)])
154+
(unless (eof-object? c)
155+
(send text insert (string c) (send text last-position) (send text last-position))
156+
(loop))))))
157+
out)

0 commit comments

Comments
 (0)