On Mar 18, 2010, at 4:17 PM, David Nolen wrote:
> On Thu, Mar 18, 2010 at 4:25 PM, alux <[email protected]> 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.))
>
> You probably want
>
> (defn describe-path [path]
> `(~'there ~'is ~'a ~(second path) ~'going ~(first path) ~'from ~'here))
Or just:
(defn describe-path [path]
['there 'is 'a (second path) 'path 'going (first path) 'from 'here])
But using symbols for something like this is a bit contrived anyway.
-Michael
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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.