In Drracket I am being tasked with creating a recursive macro that can take in (edges n1 -> n2 <-> n3) for example, with n1, n2, and n3 being (define-struct node (name edges)). The -> indicates putting the second node into the edges of the first node and the <-> indicates doing it both ways. So n1 would have edges n2 and n2 would have edges n3 and n3 would have edges n2. My problem lies in Drracket recursive macros. When you have a variable with an ellipse after it, ex: (edges n1 -> n2 ...) in the pattern matcher, I don't know how to reference just n2 without also evaluating the ellipse.
(define-syntax edges
(syntax-rules (-> <->)
[(edges n1 -> n2 ...)
(begin
(set-node-edges! n1 (cons (n2 ...) (node-edges n1)))
(edges n2 ...))]
[(edges n1 <-> n2 ...)
(begin
(begin
(set-node-edges! n1 (cons (n2 ...) (node-edges n1)))
(set-node-edges! n2 ... (cons 'n1 (node-edges n2 ...))))
(edges n2 ...))]
[(edges n1)
void]))