generated from jackfirth/racket-package-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
named-let-loop-to-for/list
rule (#268)
It can refactor this: ```scheme (let loop ([methods-check-boxess methods-check-boxess]) (cond [(null? methods-check-boxess) null] [else (cons (let loop ([methods-check-boxes (car methods-check-boxess)]) (cond [(null? methods-check-boxes) null] [else (cons (send (car methods-check-boxes) get-value) (loop (cdr methods-check-boxes)))])) (loop (cdr methods-check-boxess)))])) ``` Into this: ```scheme (for/list ([methods-check-boxes (in-list methods-check-boxess)]) (for/list ([methods-check-box (in-list methods-check-boxes)]) (send methods-check-box get-value))) ```
- Loading branch information
Showing
5 changed files
with
197 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#lang racket/base | ||
|
||
|
||
(require racket/contract/base) | ||
|
||
|
||
(provide | ||
(contract-out | ||
[depluralize-id (-> identifier? identifier?)])) | ||
|
||
|
||
(require racket/string | ||
racket/syntax) | ||
|
||
|
||
;@---------------------------------------------------------------------------------------------------- | ||
|
||
|
||
(define (depluralize-id id) | ||
(define plural-name (symbol->string (syntax-e id))) | ||
(define singular-name | ||
(cond | ||
[(string-suffix? plural-name "es") (string-trim plural-name "es" #:left? #false)] | ||
[(string-suffix? plural-name "s") (string-trim plural-name "s" #:left? #false)] | ||
[else plural-name])) | ||
(format-id id "~a" (string->symbol singular-name))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters