<div dir="ltr"><div><div>Hi, I'm a newbie Racketeer so apologies if this is a silly question:<br><br>Is it possible to pass a list of dispatch-clause to dispatch-rules? Naive use of "apply" doesn't work:<br>
<br><span style="font-family:courier new,monospace">(define-values (blog-dispatch blog-url)<br> (let ([arglist<br> (list <br> [("") list-posts]<br> [("posts" (string-arg)) review-post]<br>
[("archive" (integer-arg) (integer-arg)) review-archive]<br> [else list-posts])])<br> (apply dispatch-rules arglist)))</span><br><br></div>(example modified from <a href="http://docs.racket-lang.org/web-server/dispatch.html">docs.racket-lang.org/web-server/dispatch.html</a>) This code gives rise to the error <br>
<br><span style="font-family:courier new,monospace">string-arg: this match expander must be used inside match in: (string-arg)<br><br></span></div><div>Maybe there's something clever I could do with delay and force, but I'm not very familiar with how they work<span style="font-family:courier new,monospace">...<br>
</span></div><div><span style="font-family:courier new,monospace"><br></span></div>Background: the reason I want to do this is so that I can dynamically construct a list of all the filenames in a directory of static html files and make dispatch clauses so that they can be accessed at URL's without ".html" on the end.<br>
<br>Thanks in advance for any guidance!<br><br>Tobias<span style="font-family:courier new,monospace"><br></span></div>