On Wed, 18 Jul 2018 at 19:38, Gregg Reynolds <d...@mobileink.com> wrote:

>
> On Tue, Jul 17, 2018, 4:11 PM James Reeves <ja...@booleanknot.com> wrote:
>
>>
>> A data literal evaluates to itself. So for example, `2` is a literal,
>> because we only need to read it to know its value, whereas `(+ 1 1)`
>> isn't a literal, because we also need to evaluate it to work out the value.
>>
>
> Fair enough. But by that definition function expressions are also literals.
>

Not at all:

user=> (defn literal? [s] (let [e (read-string s)] (= e (eval e))))
#'user/literal?
user=> (literal? "2")
true
user=> (literal? "(fn [x] x)")
false
user=> (literal? "#(%)")
false
user=> (literal? "+")
false

Function expressions don't evaluate to themselves.

-- 
James Reeves
booleanknot.com

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to