Skip to content

Commit 8dfbc9a

Browse files
Copilotjackfirth
andcommitted
Improve code clarity in flatten-apply-append-syntax-template rule
Co-authored-by: jackfirth <[email protected]>
1 parent 3cc4a3d commit 8dfbc9a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

default-recommendations/syntax-shortcuts.rkt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,13 @@
114114

115115
#:with flattened-template
116116
(let* ([inner-attrs (attribute inner)]
117-
; Wrap in list if it's not already a list
117+
; When matching ((inner ...) ...), the inner attribute contains the elements from
118+
; within each nested list. If there's only one element, inner-attrs will be a single
119+
; syntax object, otherwise it's a list. We need a list for appending the ellipses.
118120
[inner-list (if (list? inner-attrs) inner-attrs (list inner-attrs))]
119121
[ellipsis-sym (datum->syntax #'here '...)])
120-
(datum->syntax #'here (append inner-list (list ellipsis-sym ellipsis-sym))))
122+
; Construct (inner-elements ... ...) by appending two ellipsis symbols
123+
(datum->syntax #'here (append inner-list (make-list 2 ellipsis-sym))))
121124

122125
(syntax->list #'flattened-template))
123126

0 commit comments

Comments
 (0)