On Wed, Jan 30, 2019 at 11:42 AM Rostislav Svoboda < rostislav.svob...@gmail.com> wrote:
> Hi Alex, > > > You can see the special cases of nil, false, and true in the LispReader > here if you're curious: > > > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L393-L413 > > I think it's not the special case of nil, false and true what's > causing me headache. I'm having difficulties wrapping my head around > following: > > ;; First quoting doesn't change the type: > user=> (= (type 42) (type (quote 42))) > true > (quote 42) is read as (quote 42). It then evaluates the list by invoking quote. quote is a special form that returns the value you pass it, without evaluation, so it evaluates to a long, whose type is java.lang.Long. > ;; But consequent quoting changes the type. Ugh ??? > user=> (= (type 42) (type (quote (quote 42)))) > false > (quote (quote 42)) is going to be read by the Clojure reader just like that: as the list (quote (quote 42)). The outer list is evaluated by invoking quote, which is a special form that returns the value, without evaluation. Here, that value is the list (quote 42) - that is, literally a list containing the symbol quote and the long 42. If you check the type of that you'll find it's a list (clojure.lang.IPersistentList). user=> (quote (quote 42)) (quote 42) user=> (type (quote (quote 42))) clojure.lang.PersistentList > My conclusion: a state has been introduced to the computation. > (presumably by the quote) > Or am I missing here something? > You seem to be missing the basic model for how Clojure reads and evaluates source, so I would suggest reading up on that a bit more. https://clojure.org/guides/learn/syntax#_evaluation https://clojure.org/reference/reader https://clojure.org/reference/evaluation https://clojure.org/reference/special_forms > Bost > > -- > 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 a topic in the > Google Groups "Clojure" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojure/K74chBn4Pis/unsubscribe. > To unsubscribe from this group and all its topics, 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.