On Tue, Mar 29, 2011 at 4:43 PM, B Smith-Mannschott
<bsmith.o...@gmail.com> wrote:
> On Tue, Mar 29, 2011 at 18:44, Saul Hazledine <shaz...@gmail.com> wrote:
>> On Mar 29, 3:13 pm, B Smith-Mannschott <bsmith.o...@gmail.com> wrote:
>>>
>>> (defn constructor
>>>  [{:keys [class-name fields] :as cfg}]
>>>  ["    " class-name "(" (formal-params cfg) ") {\n"
>>>   (statement-list
>>>    (for [f fields]
>>>      ["        this." f " = " f ]))
>>>   "    }\n"])
>>>
>>
>> Then becomes:
>>
>> (eval-string "
>> public Example(#(format-params cfg)#)
>> {
>>        #(foreach [f fields]#
>>        this.#f# = #f#;
>>        #)#
>> }")
>
> Horrible hack, maybe, but it got me thinking. What you seem to be
> doing is moving between "code" and "literal" mode by quoting with #.
> This is a little like traditional quasi-quote...
>
> And that got me thinking about Scribble [1] again.  In this context I
> think of scribble as being sort of an inverse of normal scheme syntax.
> In the end, the scribble reader produces the same kind of data
> structures as the normal scheme reader, but the emphasis is moved from
> code to textual content. Source is content by default, but you can
> escape into logic.

TeX and LaTeX work that way, too. And in a certain sense so does
syntax quote in Clojure itself, where the macro expansion source is
the "content" and unquoted expressions can fill bits in by "escaping
into logic".

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to