<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Aug 7, 2014, at 1:28 PM, Kevin Forchione <<a href="mailto:lysseus@gmail.com">lysseus@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Aug 7, 2014, at 9:50 AM, Kevin Forchione <<a href="mailto:lysseus@gmail.com">lysseus@gmail.com</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><br class="Apple-interchange-newline">On Aug 7, 2014, at 8:55 AM, Alexander D. Knauth <<a href="mailto:alexander@knauth.org">alexander@knauth.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote type="cite" style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div>Do you want something like this then:</div><div><font face="Courier New">(syntax-parse stx</font></div><div><font face="Courier New"> [(_ (~or ((((e ...) ...) ...) ...)</font></div><div><span style="font-family: 'Courier New';"> </span><font face="Courier New">(((d ...) ...) ...)</font></div><div><font face="Courier New"> ((c ...) ...)</font></div><div><font face="Courier New"> (b ...)</font></div><div><font face="Courier New"> a)</font></div><div><font face="Courier New"> . . .)</font></div><div><font face="Courier New"> #’(list (list a ... (list b ... (list c ... (list d ... (list e ...) ...) ...) ...) ...) ...)])</font></div></div></blockquote><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Sorry I meant this:</div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div>(syntax-parse #'(x (1 2 3 4) (5 (6 7) 8))</div><div> [(_ (~or ((~or ((~or ((~or (e ...) d) ...) c) ...) b) ...) a) ...)</div><div> #'(list (list a ... (list b ... (list c ... (list d ... (list e ...) ...) ...) ...) ...))])</div></div><br style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Except going infinitely? For that I think you would need a recursive helper function. </div><div><br></div><div>Or do you want to just replace all instances of (a ...) with (list a ...) ?:</div><div><font face="Courier New">(define-syntax-class thing</font></div><div><font face="Courier New"> #:attributes (norm)</font></div><div><font face="Courier New"> [pattern (a:thing ...)</font></div><div><font face="Courier New"> #:with norm (list a.norm ...)]</font></div><div><font face="Courier New"> [pattern a</font></div><div><font face="Courier New"> #:with norm a])</font></div><div><br></div><div>Or what?</div></div></blockquote></blockquote><br></div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Sorry, I should probably clarify the problem I’m attempting to solve. I’ve got an application that creates a composite image using classes of objects that draw themselves. Essentially the macro Compose-A </div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"> (compose-A (<img | (img …)> …) …)</div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">would produce something like:</div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"> {compose-A (compose-B <img | (compose-C img …)> …) …)</div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Compose-A can have an arbitrary number of compose-B clauses. </div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">compose-B clauses can have an arbitrarily number of elements in any order consisting of ing or clause-C. </div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">The clause-C consist of an arbitrary number of img. </div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I’ve been wondering about having to go with a recursive macro. Is there any code in the current system that can be modeled from?</div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">-Kevin</div></blockquote><br></div><div>Actually, now that I think about it, the pattern can be generalized:</div><div><br></div><div>(compose-macro [func …) <atom ! (<atom | (atom …)> …)> …)</div><div><br></div><div>producing something like:</div><div><br></div><div>{func0 <atom | (func1 <atom | (func2 atom …)> …)> …), etc.</div><div><br></div>Essentially each clause consisting of an image or a sub-list, with succeeding levels of sub-list applying a new compose function to its arguments. I have to apologize, I don’t think I’ve captured the idea correctly with my notation. <div><div><br></div><div>—Kevin</div></div></div></blockquote></div><br><div>Ok then would this work for what you want?</div><div><div><font face="Courier New">(define-syntax-class (thing fs)</font></div><div><font face="Courier New"> #:attributes (norm)</font></div><div><font face="Courier New"> [pattern x #:when (empty? fs)</font></div><div><font face="Courier New"> #:with norm #'x]</font></div><div><font face="Courier New"> [pattern (x ...)</font></div><div><font face="Courier New"> #:declare x (thing (rest fs))</font></div><div><font face="Courier New"> #:with f (first fs)</font></div><div><font face="Courier New"> #:with norm #'(f x.norm ...)]</font></div><div><font face="Courier New"> [pattern x #:with norm #'x])</font></div><div><font face="Courier New">(syntax-parse #'(x [f1 f2 f3] (1 2 3 4) (5 (6 7) 8))</font></div><div><font face="Courier New"> [(_ [f ...] . x)</font></div><div><font face="Courier New"> #:declare x (thing (syntax->list #'(f ...)))</font></div><div><font face="Courier New"> #'x.norm])</font></div><div><font face="Courier New">; #<syntax (f1 (f2 1 2 3 4) (f2 5 (f3 6 7) 8))></font></div></div><div><br></div><div><br></div><div><br></div></body></html>