Re: Is there a String protocol?

2011-10-28 Thread Stuart Sierra
You can use `read-string` as a general-purpose String-to-Number conversion. -S -- 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

Re: Is there a String protocol?

2011-10-28 Thread Sean Devlin
Yes, read-string is awesome, but that doesn't work as a number protocol. Python's int works on numbers and strings, and returns an int. A set of Clojure protocols that do the same would be very, very handy. Sean On Oct 28, 10:22 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: You can use

Re: Is there a String protocol?

2011-10-27 Thread Sean Devlin
Eh, I'm more interested in the int/long/double protocol, and was asking about the string one as a matter of completeness. NumberClass/parseNumber doesn't take a broad range of inputs, yadda yadda yadda... On Oct 25, 5:06 pm, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Tue, Oct 25, 2011

Is there a String protocol?

2011-10-25 Thread Sean Devlin
I was wondering if there was a common protocol to get a string representation of an object yet. Also, are there common protocols for ints, doubles, chars, etc? Having just spent a lot of time writing Python, having an int function that worked on both Strings and Ints was great. I'd love to be

Re: Is there a String protocol?

2011-10-25 Thread Alan Malloy
java.lang.Object.toString On Oct 25, 5:45 am, Sean Devlin francoisdev...@gmail.com wrote: I was wondering if there was a common protocol to get a string representation of an object yet.  Also, are there common protocols for ints, doubles, chars, etc?  Having just spent a lot of time writing

Re: Is there a String protocol?

2011-10-25 Thread Ben Smith-Mannschott
On Tue, Oct 25, 2011 at 14:45, Sean Devlin francoisdev...@gmail.com wrote: I was wondering if there was a common protocol to get a string representation of an object yet.  Also, are there common protocols for ints, doubles, chars, etc?  Having just spent a lot of time writing Python, having an