On Wed, Jul 18, 2018, 2:25 PM Robert Levy <r.p.l...@gmail.com> wrote:

> > Of course you have to "evaluate" to know that, but you also have to
> evaluate "2" in the same way to know what it means.
>
> I think you're missing the point.
>

I think maybe we're talking about different things.

2 is literal because you read it, eval it, print it, and 2 (the result of
> evaluation) as printed is the same as the original input. A function is
> read, eval'd, printed and is *not* the same as what was read in. E.g  {:a
> +}  => {:a #function[clojure.core/+]}
>

Same meaning?


> Literals can be persisted to strings and read back in with no problem,
> whereas non-literals can't.
>

That's a different definition of "literal", no? James talked about
evaluation, not printed form. Value != Print representation?

>
> On Wed, Jul 18, 2018 at 12:19 PM Gregg Reynolds <d...@mobileink.com> wrote:
>
>>
>>
>> On Wed, Jul 18, 2018, 1:55 PM James Reeves <ja...@booleanknot.com> wrote:
>>
>>> 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.
>>>
>>
>> To me that means either the definition is wrong or your literal? is
>> rigged. Probably the latter; "literal" is meta, it can't be in the language.
>>
>> Look at it this way: the meaning ("value") of "lambda x.x+1" is just the
>> function that increments its arg. Of course you have to "evaluate" to know
>> that, but you also have to evaluate "2" in the same way to know what it
>> means. Meaning "reduce", and neither form can be further reduced.
>>
>> Anyway my point is that clojure, like lisp, is a form of the lambda
>> calculus, where everything is a function, even the Nats like 2. To me at
>> least that is one of the most important lessons of functional programming.
>> Ymmv.
>>
>> --
>> 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.
>>
> --
> 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.
>

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