| I'm trying to write a macro for producing HTML lists, and I'm not sure if I'm doing it right. This macro should be given some expressions that print HTML and turn them into a HTML list, for example (ol (link "foo") (link "bar"))
should return something like <ol>
<li><a href="foo">foo</a></li>
<li><a href="bar">bar</a></li>
</ol>
I wrote a macro that does give that result, (mac ol items
`(tag ol
(map [tag li (pr _)]
(map tostring:eval '(,@items)))))
but my first thought is that it might be hacky and unnecessary to use `eval` for this, and perhaps even a potential security issue like when people use `eval` in JavaScript.Any thoughts on this? |