Hi,

On Feb 16, 11:26 pm, Garth Sheldon-Coulson <g...@mit.edu> wrote:


> The reason I'm asking which Java classes can hold Clojure expressions is
> --context snipped---
> list.

Ok. I understand your problem. You have maction - a mix between macro
and function - and you are not sure when to evaluate something
unquoted (function behaviour) and when not (macro behaviour). You
problem arises because you want to allow something like this (silly
example):

(def x '(Apply Plus [1 2]))
(Apply Plus ~x)

I suppose, the Apply call is contained in some wrapper macro?
(mathematica (Apply Plus ~x))? You could provide a mathematica*
function which does the work. Then the user can choose:

(def x '(Apply Plus [1 29])
(def y (list 1 2))

(mathematica (Apply Plus ~(mathematica* x) ~y))

> What I think I've decided on is something like the following:
>
> (def x '(1 2))
>
> ;in Clojuratica:
> (Apply Plus ~x)   ; unquotes x as an expression: 1 is a function, 2 is the
> argument
>
> (Apply Plus ~~x)   ; unquotes x as data: treats x as the list (1 2)
>
> or something along those lines. I have to try to make it congruent with
> Clojure's quoting and unquoting conventions.

This hijacks a little bit the unquoting. I don't know in how far this
will be of relevance, but if you use something like this in a macro,
you might run into trouble because suddenly the unquoting doesn't
match anymore. However this is only a rather fuzzy fear. You should do
some tests.

Basically it's the same idea as I proposed above: let the user specify
what he wants.

> Thanks for your input. Your criticism of my premises made me rethink my
> approach in a very constructive way.

You are welcome. :)

Sincerely
Meikel

-- 
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