Yes, this makes things much more clear -- thanks for all the insights.

On Jan 9, 10:03 pm, Chouser <chou...@gmail.com> wrote:
> On Fri, Jan 9, 2009 at 9:27 PM, Greg Fodor <gfo...@gmail.com> wrote:
>
> > 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.
>
> One subtlety that I'm not sure has been made clear here is that by
> default the REPL prints only a sort of approximation of the exact
> collection type.
>
> sorted-map, hash-map, array-map, struct, etc. objects all print like:
> {:a 1, :b 2}
>
> Both sorted-set and hash-set objects print like #{4 5 6}
>
> And yes, list, queues, and other seqs print like (7 8 9)
>
> I can only think of one kind of vector, unless you count
> LazilyPersistentVectors, which I wouldn't, really.  Count, that is.
>
> This is done not to create confusion, but to keep what the REPL prints
> from being confusingly detailed.  If you want to see the specific
> types of most of these things, you can do so by using *print-dup*:
>
> user=> (binding [*print-dup* true] (prn (hash-map :a 1, :b 2)))
> {:a 1, :b 2}
> nil
> user=> (binding [*print-dup* true] (prn (sorted-map :a 1, :b 2)))
> #=(clojure.lang.PersistentTreeMap/create {:a 1, :b 2})
> nil
>
> I hope that helps paint a more coherent picture of what's going on.
>
> --Chouser
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to