Thank you for your long answer. I like the "curry" trick :) I still don't know/use all newlisp goodies. I'm playing with newlisp http server and I wanted to use such a function in my html view templates, this is why function prints by default. Now it looks cleaner for me than println/string combinations.
Code Select
<%
(dolist (m lst)
(p {<div class="member"><b>:m:</b></div>}))
%>
For now, inspired by you, I changed the function definition so you can choose if you want printing or returning. It is solved with additional argument "ret"
Code Select
(define (P str (ret nil) (sep ":"))
(set 'fields '())
(find-all (format {%s([a-z0-9-]+)%s} sep sep) str (push $1 fields -1))
(dolist (f fields)
(if (set 'val (eval (sym f MAIN nil)))
(replace (string sep f sep) str (string val))))
(if (not ret)
(println str)
str))