I just did this :

(defn describe-path [path]
  `(there is a ,(second path) going ,(first path) from here.))

which gives me :
(describe-path (list "left" "right"))
(user/there user/is user/a (clojure.core/second user/path) user/going
(clojure.core/first user/path) user/from here.)

Sure, it prepends the namespace to the symbol. Is that the issue ?
I thats the the case I guess you can use something like (concat...).

On Thu, Mar 18, 2010 at 4:25 PM, alux <alu...@googlemail.com> wrote:

> Hello!
>
> I much enjoyed reading the tutorial http://www.lisperati.com/casting.html
> , mentioned by eyeris today. The most mind-extending thing (to me,
> having Java background) is the, admittedly non-idiomatic, use of
> symbols as data.
>
> But I have two translation problems, I want to pose before going to
> sleep (its pitch dark in Europe :). First the easy one:
>
> Common Lisp
> (defun describe-path (path)
>  `(there is a ,(second path) going ,(first path) from here.))
>
> My Clojure version, I use a map:
> (defn describe-path [path]
>        (let [what (path :kind) where (path :direction)]
>    (concat '(there is a) (list what) '(going) (list where) '(from
> here.))))
>
> Thats much less elegant. Is there a nicer way?
>
> Thank you, alux
>
> --
> 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<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to clojure+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to