Ok, this makes sense to me now. So, correct me if I'm wrong, but is it safe to say that when you see parentheses surrounding values in the REPL output, that indicates the presence of a sequence, not necessarily a list? Still a little bit odd since one could almost argue that if that's the case you should never see parenthesis in the output of the REPL, since that symbology I assume is 'inspired' by the reader's expected syntax and regular parens are used for list literals, but either way it seems consistent to me now.
At the end of the day this seems to be a subtle design decision made to make things seem more Lisp-like in the REPL output, despite the fact that Clojure is working with seq's not cons cells when drawing that output. > sequence. Basically, lists and lazy sequences are two different > implementations of an abstraction called a "sequence." This means > that anywhere a sequence is asked for, either can be used, no > questions asked. They're both sequences that have a certain set of > behavior that they share, it's just how they go about that behavior > that is different. When a list is printed out at the REPL, it -is- a > sequence being printed out, there is literally no distinction between > a list and the sequence view of that list, as evidenced by (let [a '(1 > 2 3)] (identical? a (seq a))) returning true. A vector meanwhile is - > not- itself a sequence, it can only be viewed as one. That is the > distinction between your examples. > > On Jan 9, 8:47 pm, Greg Fodor <gfo...@gmail.com> wrote: > > > Right, what I was more pointing out is the fact that the printed > > version of a sequence in the REPL is syntactically identical to that > > of a list. Which, clearly for most intents and purposes is a great > > representation in output for using the REPL while doing development. > > However, for a newcomer particularly, I feel like it may be valuable > > for a seq to annotate it's printed version with syntax that it is not > > a literal list but is a sequence that, when expanded, results in the > > set of values indicated by the list (or, the subset of values > > indicated by the list of length *print-length*) > > > Again, its a nitpick, but basically was a point of confusion for me > > and I thought it might be a useful thing to realize since I'd guess > > it's something that wears off in the first few days of using the > > language. But, it might be a sticking point for some new users who are > > learning the difference between lists (a la LISP) and lazy sequences a > > la Clojure. > > > On Jan 9, 8:41 pm, "Mark Engelberg" <mark.engelb...@gmail.com> wrote: > > > > A sequence evaluates its elements on demand. The REPL needs to > > > evaulate the elements in order to print them. You can control how > > > many elements are printed by changing *print-length*. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---