Ken, 
Thanks for your reply. Is that about what you mean? 

(defmacro literal? [form]
  (list 'if `(not (list? ~form)) true false))

Andreas

On 09/01/2011, at 8:59 AM, Ken Wesson wrote:

> On Sat, Jan 8, 2011 at 6:49 PM, Andreas Kostler
> <andreas.koestler.le...@gmail.com> wrote:
>> Hello again,
>> How do I test for a literal? There are predicates for symbols and
>> keywoards etc:
>> symbol?, keyword?
>> Is there an equivalent for literals...like literal?
> 
> Not at runtime. At macroexpansion time you can use list? and that's
> *almost* correct -- literal strings, numbers, vectors, and such will
> give false (though, for instance, a literal vector may contain
> expressions and other nonliteral contents) and s-expression will give
> true. On the other hand, '(1 2 3) will give true as well (but quoted
> literal lists are uncommon in Clojure).
> 
> -- 
> 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

--
 “There is a strong correlation between being smart and being a nerd, and an 
even stronger inverse correlation between being a nerd and being popular”
(Paul Graham)
-- 
**********************************************************
Andreas Koestler, Software Engineer
Leica Geosystems Pty Ltd
270 Gladstone Road, Dutton Park QLD 4102
Main: +61 7 3891 9772     Direct: +61 7 3117 8808
Fax: +61 7 3891 9336
Email: andreas.koest...@leica-geosystems.com

************www.leica-geosystems.com*************

when it has to be right, Leica Geosystems

Please  consider the environment before printing this email.





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