From fe79cdc96d2f32426be7b8bec563b752c14c154f Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:14:30 +0000 Subject: [PATCH 1/9] Fix 1 occurrence of `hash-ref-with-constant-lambda-to-hash-ref-without-lambda` The lambda can be removed from the failure result in this `hash-ref` expression. --- drracket/browser/private/entity-names.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drracket/browser/private/entity-names.rkt b/drracket/browser/private/entity-names.rkt index 0095cff99..9809e7099 100644 --- a/drracket/browser/private/entity-names.rkt +++ b/drracket/browser/private/entity-names.rkt @@ -256,6 +256,6 @@ (euro . 8364))) (define (entity-name->integer s) - (hash-ref table s (lambda () #f))) + (hash-ref table s #f)) From e35ad785a2a4ff34427a2f31e673d9feb1e8b212 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:14:30 +0000 Subject: [PATCH 2/9] Fix 11 occurrences of `let-to-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- .../scribble/tools/private/mk-drs-bitmaps.rkt | 16 +- drracket/browser/private/bullet.rkt | 19 +-- drracket/browser/private/html.rkt | 161 ++++++++---------- 3 files changed, 91 insertions(+), 105 deletions(-) diff --git a/drracket-core-lib/scribble/tools/private/mk-drs-bitmaps.rkt b/drracket-core-lib/scribble/tools/private/mk-drs-bitmaps.rkt index e26016bb4..f88002b6c 100644 --- a/drracket-core-lib/scribble/tools/private/mk-drs-bitmaps.rkt +++ b/drracket-core-lib/scribble/tools/private/mk-drs-bitmaps.rkt @@ -10,14 +10,14 @@ (define (draw dc str dx dy color?) (send dc clear) (send dc set-font (send the-font-list find-or-create-font 15 " Futura" 'swiss 'normal 'bold)) - (let-values ([(tw th _1 _2) (send dc get-text-extent "@")]) - (when color? (send dc set-text-foreground (send the-color-database find-color "gray"))) - (send dc draw-text "@" - (- (/ width 2) (/ tw 2)) - (- (/ height 2) (/ th 2))) - (send dc set-font (send the-font-list find-or-create-font 6 " Gill Sans" 'swiss 'normal 'bold)) - (when color? (send dc set-text-foreground (send the-color-database find-color "purple"))) - (send dc draw-text str (+ 0 dx) (- height dy) #f 0 (* pi 1/4)))) + (define-values (tw th _1 _2) (send dc get-text-extent "@")) + (when color? + (send dc set-text-foreground (send the-color-database find-color "gray"))) + (send dc draw-text "@" (- (/ width 2) (/ tw 2)) (- (/ height 2) (/ th 2))) + (send dc set-font (send the-font-list find-or-create-font 6 " Gill Sans" 'swiss 'normal 'bold)) + (when color? + (send dc set-text-foreground (send the-color-database find-color "purple"))) + (send dc draw-text str (+ 0 dx) (- height dy) #f 0 (* pi 1/4))) (define f (new frame% [label ""] [width 100] [height 100] [alignment '(center center)])) (define c (new canvas% diff --git a/drracket/browser/private/bullet.rkt b/drracket/browser/private/bullet.rkt index 3ec528198..19db107e4 100644 --- a/drracket/browser/private/bullet.rkt +++ b/drracket/browser/private/bullet.rkt @@ -51,16 +51,15 @@ [(0) (values (lambda (x y w h) (send dc draw-ellipse x y w h)) #t)] [(1) (values (lambda (x y w h) (send dc draw-ellipse x y w h)) #f)] [else (values (lambda (x y w h) (send dc draw-rectangle x y w h)) #f)])]) - (let ([b (send dc get-brush)]) - (send dc set-brush - (if solid? - (send the-brush-list - find-or-create-brush - (send (send dc get-pen) get-color) - 'solid) - transparent-brush)) - (draw x y bsize bsize) - (send dc set-brush b)))))] + (define b (send dc get-brush)) + (send dc set-brush + (if solid? + (send the-brush-list find-or-create-brush + (send (send dc get-pen) get-color) + 'solid) + transparent-brush)) + (draw x y bsize bsize) + (send dc set-brush b))))] [define/override copy (lambda () (make-object bullet-snip% depth))] diff --git a/drracket/browser/private/html.rkt b/drracket/browser/private/html.rkt index 3514dd669..9f4563238 100644 --- a/drracket/browser/private/html.rkt +++ b/drracket/browser/private/html.rkt @@ -118,19 +118,17 @@ (super on-event dc x y editor-x editor-y evt)) (define/override (adjust-cursor dc x y editor-x editor-y evt) - (let ([snipx (- (send evt get-x) x)] - [snipy (- (send evt get-y) y)]) - (if (find-rect snipx snipy) - finger-cursor - #f))) + (define snipx (- (send evt get-x) x)) + (define snipy (- (send evt get-y) y)) + (if (find-rect snipx snipy) finger-cursor #f)) ;; warning: buggy. This doesn't actually copy the bitmap ;; over because there's no get-bitmap method for image-snip% ;; at the time of this writing. (define/override (copy) - (let ([cp (new image-map-snip% (html-text html-text))]) - (send cp set-key key) - (send cp set-rects rects))) + (define cp (new image-map-snip% (html-text html-text))) + (send cp set-key key) + (send cp set-rects rects)) (super-make-object) @@ -143,9 +141,9 @@ ;; (define (make-racket-color-delta col) - (let ([d (make-object style-delta%)]) - (send d set-delta-foreground col) - d)) + (define d (make-object style-delta%)) + (send d set-delta-foreground col) + d) (define racket-code-delta (make-racket-color-delta "brown")) (define racket-code-delta/keyword @@ -163,17 +161,17 @@ (define current-style-class (make-parameter null)) (define (lookup-class-delta class) - (let ([class-path (cons class (current-style-class))]) - (cond - [(sub-path? class-path '("racket")) racket-code-delta] - [(sub-path? class-path '("keyword" "racket")) racket-code-delta/keyword] - [(sub-path? class-path '("variable" "racket")) racket-code-delta/variable] - [(sub-path? class-path '("global" "racket")) racket-code-delta/global] - [(or (sub-path? class-path '("selfeval" "racket")) - (sub-path? class-path '("racketresponse"))) racket-code-delta/selfeval] - [(sub-path? class-path '("comment" "racket")) racket-code-delta/comment] - [(sub-path? class-path '("navigation")) navigation-delta] - [else #f]))) + (define class-path (cons class (current-style-class))) + (cond + [(sub-path? class-path '("racket")) racket-code-delta] + [(sub-path? class-path '("keyword" "racket")) racket-code-delta/keyword] + [(sub-path? class-path '("variable" "racket")) racket-code-delta/variable] + [(sub-path? class-path '("global" "racket")) racket-code-delta/global] + [(or (sub-path? class-path '("selfeval" "racket")) (sub-path? class-path '("racketresponse"))) + racket-code-delta/selfeval] + [(sub-path? class-path '("comment" "racket")) racket-code-delta/comment] + [(sub-path? class-path '("navigation")) navigation-delta] + [else #f])) (define (sub-path? a b) (cond @@ -241,34 +239,34 @@ ;; cache-bitmap : string -> (is-a?/c bitmap%) (define (cache-bitmap url) - (let ([url-string (url->string url)]) - (let loop ([n 0]) - (cond - [(= n NUM-CACHED) - ;; Look for item to uncache - (vector-set! cached-use 0 (max 0 (sub1 (vector-ref cached-use 0)))) - (let ([m (let loop ([n 1][m (vector-ref cached-use 0)]) - (if (= n NUM-CACHED) - m - (begin - (vector-set! cached-use n (max 0 (sub1 (vector-ref cached-use n)))) - (loop (add1 n) (min m (vector-ref cached-use n))))))]) - (let loop ([n 0]) - (if (= (vector-ref cached-use n) m) - (let ([bitmap (get-bitmap-from-url url)]) - (cond + (define url-string (url->string url)) + (let loop ([n 0]) + (cond + [(= n NUM-CACHED) + ;; Look for item to uncache + (vector-set! cached-use 0 (max 0 (sub1 (vector-ref cached-use 0)))) + (let ([m (let loop ([n 1] + [m (vector-ref cached-use 0)]) + (if (= n NUM-CACHED) + m + (begin + (vector-set! cached-use n (max 0 (sub1 (vector-ref cached-use n)))) + (loop (add1 n) (min m (vector-ref cached-use n))))))]) + (let loop ([n 0]) + (if (= (vector-ref cached-use n) m) + (let ([bitmap (get-bitmap-from-url url)]) + (cond [bitmap (vector-set! cached n bitmap) (vector-set! cached-name n url-string) (vector-set! cached-use n 5) bitmap] [else #f])) - (loop (add1 n)))))] - [(equal? url-string (vector-ref cached-name n)) - (vector-set! cached-use n (min 10 (add1 (vector-ref cached-use n)))) - (vector-ref cached n)] - [else - (loop (add1 n))])))) + (loop (add1 n)))))] + [(equal? url-string (vector-ref cached-name n)) + (vector-set! cached-use n (min 10 (add1 (vector-ref cached-use n)))) + (vector-ref cached n)] + [else (loop (add1 n))]))) (define (update-image-maps image-map-snips image-maps) (for-each @@ -305,28 +303,25 @@ ;; matches the above, it is interprted propoerly; ;; otherwise silently nothing happens. (define (add-area image-map-snip sexp) - (let ([shape #f] - [coords #f] - [href #f]) - (let loop ([sexp sexp]) - (cond - [(pair? sexp) - (let ([fst (car sexp)]) - (when (and (pair? fst) - (symbol? (car fst)) - (pair? (cdr fst)) - (string? (cadr fst))) - (case (car fst) - [(shape) (set! shape (cadr fst))] - [(coords) (set! coords (cadr fst))] - [(href) (set! href (cadr fst))] - [else (void)])) - (loop (cdr sexp)))] - [else (void)])) - (when (and shape coords href) - (let ([p-coords (parse-coords coords)]) - (when p-coords - (send image-map-snip add-area shape p-coords href)))))) + (define shape #f) + (define coords #f) + (define href #f) + (let loop ([sexp sexp]) + (cond + [(pair? sexp) + (let ([fst (car sexp)]) + (when (and (pair? fst) (symbol? (car fst)) (pair? (cdr fst)) (string? (cadr fst))) + (case (car fst) + [(shape) (set! shape (cadr fst))] + [(coords) (set! coords (cadr fst))] + [(href) (set! href (cadr fst))] + [else (void)])) + (loop (cdr sexp)))] + [else (void)])) + (when (and shape coords href) + (let ([p-coords (parse-coords coords)]) + (when p-coords + (send image-map-snip add-area shape p-coords href))))) ;; parse-coords : string -> (listof number) ;; separates out a bunch of comma separated numbers in a string @@ -337,10 +332,9 @@ [(regexp-match #rx"^[ \t\n]*([0-9]+)[ \t\n]*,(.*)$" str) => (lambda (m) - (let ([num (cadr m)] - [rst (caddr m)]) - (cons (string->number num) - (loop rst))))] + (define num (cadr m)) + (define rst (caddr m)) + (cons (string->number num) (loop rst)))] [(regexp-match #rx"^[ \t\n]*([0-9]+)[ \t\n]*" str) => (lambda (m) @@ -348,25 +342,18 @@ [else null]))) (define (make-get-field str) - (let ([s (apply - string-append - (map - (lambda (c) - (format "[~a~a]" - (char-upcase c) - (char-downcase c))) - (string->list str)))] - [spc (string #\space #\tab #\newline #\return #\vtab)]) - (let ([re:plain (regexp (format "(^|[~a])~a[~a]*=[~a]*([^~a]*)" spc s spc spc spc))] - [re:quote (regexp (format "(^|[~a])~a[~a]*=[~a]*\"([^\"]*)\"" spc s spc spc))]) - (lambda (args) - (let ([m (or (regexp-match re:quote args) - (regexp-match re:plain args))]) - (and m (caddr m))))))) + (define s + (apply string-append + (map (lambda (c) (format "[~a~a]" (char-upcase c) (char-downcase c))) (string->list str)))) + (define spc (string #\space #\tab #\newline #\return #\vtab)) + (define re:plain (regexp (format "(^|[~a])~a[~a]*=[~a]*([^~a]*)" spc s spc spc spc))) + (define re:quote (regexp (format "(^|[~a])~a[~a]*=[~a]*\"([^\"]*)\"" spc s spc spc))) + (lambda (args) + (let ([m (or (regexp-match re:quote args) (regexp-match re:plain args))]) (and m (caddr m))))) (define (get-field e name) - (let ([a (assq name (cadr e))]) - (and a (cadr a)))) + (define a (assq name (cadr e))) + (and a (cadr a))) (define get-racket-arg (let ([get-rkt (make-get-field "racket")]) From 50bb0b42fa6a54f8f6fbf22c8c3e301180135ae1 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:14:30 +0000 Subject: [PATCH 3/9] Fix 1 occurrence of `define-lambda-to-define` The `define` form supports a shorthand for defining functions. --- drracket/browser/private/html.rkt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drracket/browser/private/html.rkt b/drracket/browser/private/html.rkt index 9f4563238..288d6bb32 100644 --- a/drracket/browser/private/html.rkt +++ b/drracket/browser/private/html.rkt @@ -191,15 +191,14 @@ (define re:hexcolor (regexp "^#([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$")) -(define color-string->color - (lambda (str) - (let ([m (regexp-match re:hexcolor str)]) - (if m - (make-object color% - (string->number (cadr m) 16) - (string->number (caddr m) 16) - (string->number (cadddr m) 16)) - (send the-color-database find-color str))))) +(define (color-string->color str) + (let ([m (regexp-match re:hexcolor str)]) + (if m + (make-object color% + (string->number (cadr m) 16) + (string->number (caddr m) 16) + (string->number (cadddr m) 16)) + (send the-color-database find-color str)))) (define html-eval-ok (make-parameter #t)) (define html-img-ok (make-parameter #t)) From c0d5f106be04ee613ce4306c00f57eb4c302dfcc Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:14:30 +0000 Subject: [PATCH 4/9] Fix 1 occurrence of `if-else-false-to-and` This `if` expression can be refactored to an equivalent expression using `and`. --- drracket/browser/private/html.rkt | 53 +++++++++++++------------------ 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/drracket/browser/private/html.rkt b/drracket/browser/private/html.rkt index 288d6bb32..b286820af 100644 --- a/drracket/browser/private/html.rkt +++ b/drracket/browser/private/html.rkt @@ -204,37 +204,28 @@ (define html-img-ok (make-parameter #t)) (define (get-bitmap-from-url url) - (if (html-img-ok) - (let ([tmp-filename (make-temporary-file "rktguiimg~a")]) - (load-status #t "image" url) - (call-with-output-file* tmp-filename - (lambda (op) - (with-handlers ([exn:fail? - (lambda (x) - (printf "exn.9 ~s\n" (and (exn? x) - (exn-message x))) - (void))]) - (call/input-url - url - get-pure-port - (lambda (ip) - (copy-port ip op))))) - #:exists 'truncate) - (pop-status) - (let ([bitmap (make-object bitmap% tmp-filename)]) - (with-handlers ([exn:fail? - (lambda (x) - (message-box "Warning" - (format "Could not delete file ~s\n\n~a" - tmp-filename - (if (exn? x) - (exn-message x) - x))))]) - (delete-file tmp-filename)) - (if (send bitmap ok?) - bitmap - #f))) - #f)) + (and (html-img-ok) + (let ([tmp-filename (make-temporary-file "rktguiimg~a")]) + (load-status #t "image" url) + (call-with-output-file* + tmp-filename + (lambda (op) + (with-handlers ([exn:fail? (lambda (x) + (printf "exn.9 ~s\n" (and (exn? x) (exn-message x))) + (void))]) + (call/input-url url get-pure-port (lambda (ip) (copy-port ip op))))) + #:exists 'truncate) + (pop-status) + (let ([bitmap (make-object bitmap% tmp-filename)]) + (with-handlers ([exn:fail? (lambda (x) + (message-box "Warning" + (format "Could not delete file ~s\n\n~a" + tmp-filename + (if (exn? x) + (exn-message x) + x))))]) + (delete-file tmp-filename)) + (if (send bitmap ok?) bitmap #f))))) ;; cache-bitmap : string -> (is-a?/c bitmap%) (define (cache-bitmap url) From d281697785defcd58f93a463563081b8a634e5cd Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:14:30 +0000 Subject: [PATCH 5/9] Fix 2 occurrences of `for-each-to-for` This `for-each` operation can be replaced with a `for` loop. --- drracket/browser/private/html.rkt | 26 ++++++++++-------------- drracket/browser/private/option-snip.rkt | 19 ++++++++--------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/drracket/browser/private/html.rkt b/drracket/browser/private/html.rkt index b286820af..d30cbe82c 100644 --- a/drracket/browser/private/html.rkt +++ b/drracket/browser/private/html.rkt @@ -259,21 +259,17 @@ [else (loop (add1 n))]))) (define (update-image-maps image-map-snips image-maps) - (for-each - (lambda (image-map-snip) - (let ([image-map-key (send image-map-snip get-key)]) - (let loop ([image-maps image-maps]) - (cond - [(null? image-maps) (void)] - [else - (let* ([image-map (car image-maps)] - [name (get-field image-map 'name)]) - (if (and name - (equal? (format "#~a" name) - (send image-map-snip get-key))) - (find/add-areas image-map-snip image-map) - (loop (cdr image-maps))))])))) - image-map-snips)) + (for ([image-map-snip (in-list image-map-snips)]) + (send image-map-snip get-key) + (let loop ([image-maps image-maps]) + (cond + [(null? image-maps) (void)] + [else + (let* ([image-map (car image-maps)] + [name (get-field image-map 'name)]) + (if (and name (equal? (format "#~a" name) (send image-map-snip get-key))) + (find/add-areas image-map-snip image-map) + (loop (cdr image-maps))))])))) (define (find/add-areas image-map-snip image-map) (let loop ([sexp image-map]) diff --git a/drracket/browser/private/option-snip.rkt b/drracket/browser/private/option-snip.rkt index 4d3610dd1..a7229339b 100644 --- a/drracket/browser/private/option-snip.rkt +++ b/drracket/browser/private/option-snip.rkt @@ -101,16 +101,15 @@ [on-event (lambda (dc x y editorx editory event) (when (send event button-down?) (define popup (make-object popup-menu%)) - (for-each (lambda (o) - (make-object menu-item% - (car o) - popup - (lambda (i e) - (set! current-option o) - (let ([a (get-admin)]) - (when a - (send a needs-update this 0 0 w h)))))) - options) + (for ([o (in-list options)]) + (make-object menu-item% + (car o) + popup + (lambda (i e) + (set! current-option o) + (let ([a (get-admin)]) + (when a + (send a needs-update this 0 0 w h)))))) (define a (get-admin)) (when a (send a popup-menu popup this 0 0))))] From c4cf7ce9756749d50ccdfba46c593afd45f77c44 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:14:30 +0000 Subject: [PATCH 6/9] Fix 1 occurrence of `map-to-for` This `map` operation can be replaced with a `for/list` loop. --- drracket/browser/private/option-snip.rkt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drracket/browser/private/option-snip.rkt b/drracket/browser/private/option-snip.rkt index a7229339b..6469c0501 100644 --- a/drracket/browser/private/option-snip.rkt +++ b/drracket/browser/private/option-snip.rkt @@ -52,10 +52,9 @@ (unless w (define font (send (get-style) get-font)) (define w+h+ds - (map (lambda (o) - (let-values ([(tw th td ta) (send dc get-text-extent (car o) font)]) - (list tw th td))) - options)) + (for/list ([o (in-list options)]) + (define-values (tw th td ta) (send dc get-text-extent (car o) font)) + (list tw th td))) (if (null? w+h+ds) (begin (set! w 10) From ee7b573119833fd7707c8e491749c3c9bf26b8c2 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:14:30 +0000 Subject: [PATCH 7/9] Fix 1 occurrence of `if-begin-to-cond` Using `cond` instead of `if` here makes `begin` unnecessary --- drracket/browser/private/option-snip.rkt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drracket/browser/private/option-snip.rkt b/drracket/browser/private/option-snip.rkt index 6469c0501..caaba6064 100644 --- a/drracket/browser/private/option-snip.rkt +++ b/drracket/browser/private/option-snip.rkt @@ -55,15 +55,15 @@ (for/list ([o (in-list options)]) (define-values (tw th td ta) (send dc get-text-extent (car o) font)) (list tw th td))) - (if (null? w+h+ds) - (begin - (set! w 10) - (set! h 10) - (set! d 2)) - (begin - (set! w (+ (* 2 inset) arrow-sep 2 (* 2 arrow-height) (apply max (map car w+h+ds)))) - (set! h (+ (* 2 inset) 1 (apply max arrow-height (map cadr w+h+ds)))) - (set! d (+ inset 1 (apply max (map caddr w+h+ds))))))) + (cond + [(null? w+h+ds) + (set! w 10) + (set! h 10) + (set! d 2)] + [else + (set! w (+ (* 2 inset) arrow-sep 2 (* 2 arrow-height) (apply max (map car w+h+ds)))) + (set! h (+ (* 2 inset) 1 (apply max arrow-height (map cadr w+h+ds)))) + (set! d (+ inset 1 (apply max (map caddr w+h+ds))))])) (when hbox (set-box! hbox h)) (when wbox From 62616d81c9ec5503b156aff7ee321f121312daf5 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:14:30 +0000 Subject: [PATCH 8/9] Fix 1 occurrence of `send-chain-to-send+` This method chain made of nested `send` expressions can be written more clearly as a `send+` expression. --- drracket/browser/private/bullet.rkt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drracket/browser/private/bullet.rkt b/drracket/browser/private/bullet.rkt index 19db107e4..65b587544 100644 --- a/drracket/browser/private/bullet.rkt +++ b/drracket/browser/private/bullet.rkt @@ -11,8 +11,7 @@ (define bullet-size (make-parameter - (let ([s (send (send (send (make-object text%) get-style-list) basic-style) - get-size)]) + (let ([s (send+ (make-object text%) (get-style-list) (basic-style) (get-size))]) (max 7 (quotient s 2))))) (define (get-bullet-width) From d3d5d41d15d4c4a7b5daf77270ab838b3905d684 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:14:30 +0000 Subject: [PATCH 9/9] Fix 1 occurrence of `nested-if-to-cond` This `if`-`else` chain can be converted to a `cond` expression. --- drracket/browser/private/bullet.rkt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drracket/browser/private/bullet.rkt b/drracket/browser/private/bullet.rkt index 65b587544..554bdaa9d 100644 --- a/drracket/browser/private/bullet.rkt +++ b/drracket/browser/private/bullet.rkt @@ -67,11 +67,10 @@ (send stream put depth))] [define/override get-text (lambda (offset num flattened?) - (if (< num 1) - "" - (if flattened? - "* " - "*")))] + (cond + [(< num 1) ""] + [flattened? "* "] + [else "*"]))] (super-new) (set-snipclass bullet-snip-class) (set-count 1)))