Hi David,

On Mar 22, 5:01 pm, David Sletten <da...@bosatsu.net> wrote:
> On Mar 21, 2009, at 1:44 PM, Mark Triggs wrote:
>
> >   user=> (str (filter even? (range 1 10)))
> >   "clojure.lang.lazy...@f1005"
>
> > Previously this would readably print the contents of the seq and some
> > of my code was relying on this.  Obviously it's not difficult to call
> > `prn-str' myself, but I just wondered if this change was made
> > consciously.
>
> According to the documentation for 'str':
> With one arg x, returns x.toString().
>
> So it looks like toString() on a sequence used to return its contents  
> and now doesn't. However, rather than relying on this behavior what  
> you probably should be doing is using 'apply':
> (apply str (filter even? (range 1 10))) => "2468"
>
> If you want commas between those elements, use 'interpose':
> (apply str (interpose ", " (filter even? (range 1 10)))) => "2, 4, 6, 8"

Yep, that's fine.  In my case I was actually relying on the fact that
`str' was effectively doing a `prn-str' because I would later read it
back using `read-string' elsewhere.  Calling `prn-str' explicitly
isn't a problem--I just thought I'd mention that the semantics have
now changed a little.

Thanks,

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