Re: contains? on String

2015-05-13 Thread Sam Raker
I always assumed (contains? foo 2) worked because strings are arrays (i.e. vectors) of characters, on some level. -- 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

Re: contains? on String

2015-05-13 Thread Erik Price
(get the char at index 4) \c e ​ On Wed, May 13, 2015 at 9:55 PM, Sam Raker sam.ra...@gmail.com wrote: I always assumed (contains? foo 2) worked because strings are arrays (i.e. vectors) of characters, on some level. -- You received this message because you are subscribed to the Google

Re: contains? on String

2015-05-12 Thread Shantanu Kumar
I agree about the counter-intuitiveness. I'm only wondering whether the error message is a bit misleading contains? not supported on type: java.lang.String because of course (contains? hello 2) works fine. Shantanu On Wednesday, 13 May 2015 00:12:19 UTC+5:30, James Reeves wrote: contains?

Re: contains? on String

2015-05-12 Thread Michael Gardner
On May 12, 2015, at 1:54 PM, Shantanu Kumar kumar.shant...@gmail.com wrote: I agree about the counter-intuitiveness. I'm only wondering whether the error message is a bit misleading contains? not supported on type: java.lang.String because of course (contains? hello 2) works fine. It seems

Re: contains? on String

2015-05-12 Thread James Reeves
On 12 May 2015 at 19:54, Shantanu Kumar kumar.shant...@gmail.com wrote: I agree about the counter-intuitiveness. I'm only wondering whether the error message is a bit misleading contains? not supported on type: java.lang.String because of course (contains? hello 2) works fine. Oh, I see!

Re: contains? on String

2015-05-12 Thread James Reeves
contains? has always been a little counter-intuitive. It essentially only works on collections that allow for a constant or logarithmic lookup time, and often works on the keys of a collection, rather than its values. The only exception to this are sets, where the values are essentially keys as

contains? on String

2015-05-12 Thread Shantanu Kumar
Hi, I notice the following in Clojure 1.7.0-beta2: user= (contains? hello 2) true user= (contains? hello \e) IllegalArgumentException contains? not supported on type: java.lang.String clojure.lang.RT.contains (RT.java:800) Is this just a case of misleading error message or am I missing

Re: contains? on String

2015-05-12 Thread Fluid Dynamics
On Tuesday, May 12, 2015 at 3:34:46 PM UTC-4, Michael Gardner wrote: On May 12, 2015, at 1:54 PM, Shantanu Kumar kumar.s...@gmail.com javascript: wrote: I agree about the counter-intuitiveness. I'm only wondering whether the error message is a bit misleading contains? not supported on

Re: contains? on String

2015-05-12 Thread Michael Gardner
On May 12, 2015, at 3:28 PM, Fluid Dynamics a2093...@trbvm.com wrote: Strings and arrays support constant-time access by index. Yes, but why should that mean that contains? should work on Strings? Because it can doesn't seem compelling to me. In discussions about contains?, one often hears

Re: contains? on String

2015-05-12 Thread Devin Walters
Ignoring some of the conversation here to point out that what you want is: (.contains foo f) On Tue, May 12, 2015 at 4:04 PM, Michael Gardner gardne...@gmail.com wrote: On May 12, 2015, at 3:28 PM, Fluid Dynamics a2093...@trbvm.com wrote: Strings and arrays support constant-time access by

Re: contains? on String

2015-05-12 Thread Lee Spector
On May 12, 2015, at 4:28 PM, Fluid Dynamics a2093...@trbvm.com wrote: On Tuesday, May 12, 2015 at 3:34:46 PM UTC-4, Michael Gardner wrote: On May 12, 2015, at 1:54 PM, Shantanu Kumar kumar.s...@gmail.com javascript: wrote: I agree about the counter-intuitiveness. I'm only wondering

Re: contains? on String

2015-05-12 Thread Fluid Dynamics
On Tuesday, May 12, 2015 at 5:05:00 PM UTC-4, Michael Gardner wrote: On May 12, 2015, at 3:28 PM, Fluid Dynamics a209...@trbvm.com javascript: wrote: Strings and arrays support constant-time access by index. Yes, but why should that mean that contains? should work on Strings? Because