On Wed, 18 Jul 2018 at 20:19, Gregg Reynolds <d...@mobileink.com> wrote:
> > On Wed, Jul 18, 2018, 1:55 PM James Reeves <ja...@booleanknot.com> wrote: > >> >> 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. > How can it be rigged? It's a one line function that just returns true if an expression evaluates to itself. You can run read-string directly and see that reading a function expression results in a seq: user=> (read-string "#(%)") (fn* [p1__175#] (p1__175#)) user=> (seq? *1) true It doesn't become a function until it's evaluated 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. > Clojure (and lisps in general) distinguish between reading data and evaluating it. The integer expression "2" does not need to be evaluated: user=> (read-string "2") 2 user=> (int? 2) true And evaluating it only returns itself: user=> (eval 2) 2 user=> (= 2 (eval 2)) true In Clojure terminology, you don't need to evaluate "2" to know what it means. However, you do need to evaluate an expression like (fn [x] (+ x 1)). Merely reading it returns a list. 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. > It isn't. Certainly Clojure can trace some of its lineage back to the lambda calculus, but that's all. Not everything in Clojure is a function, or even resembles a function. -- 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.