Re: why String is not a collection (of Character)

2012-06-08 Thread Tim Visher
Hi Ambrose, On Fri, Jun 8, 2012 at 12:22 AM, Ambrose Bonnaire-Sergeant wrote: > On Fri, Jun 8, 2012 at 12:11 PM, Tim Visher wrote: >> >> >> 2. While I would very much expect the type test (coll? seq?) to return >> false on a string, I would _not_ expect the capability test >> (sequential?) to re

Re: why String is not a collection (of Character)

2012-06-08 Thread Bill Caputo
On Jun 8, 2012, at 2:21 AM, Cédric Pineau wrote: > > 2012/6/8 Cédric Pineau > > 2012/6/8 Ambrose Bonnaire-Sergeant > No. I assume you mean seqable. > > If it did exist, it would look something like: > > Is there a simple test for sequable? > > Oh ok, I don't get the difference between seq

Re: why String is not a collection (of Character)

2012-06-08 Thread Stephen Compall
On Jun 8, 2012 3:18 AM, "Cédric Pineau" wrote: > (defn seqable? More modernly, this function can be found in core.incubator. -- Stephen Compall Greetings from sunny Appleton! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, s

Re: why String is not a collection (of Character)

2012-06-08 Thread Cédric Pineau
2012/6/8 Cédric Pineau > > 2012/6/8 Ambrose Bonnaire-Sergeant > >> No. I assume you mean seqable. >> >> If it did exist, it would look something like: >> >> Is there a simple test for sequable? > > > Oh ok, I don't get the difference between seq and seqable.. > > I think I got it : (seqable? a)

Re: why String is not a collection (of Character)

2012-06-08 Thread Cédric Pineau
2012/6/8 Ambrose Bonnaire-Sergeant > No. I assume you mean seqable. > > If it did exist, it would look something like: > > Is there a simple test for sequable? Oh ok, I don't get the difference between seq and seqable.. Btw, i found this ( https://github.com/richhickey/clojure-contrib/blob/9f4

Re: why String is not a collection (of Character)

2012-06-08 Thread Meikel Brandmeyer
t: Fr, 08 Jun 2012, 08:58:51 MESZ Betreff: Re: why String is not a collection (of Character) Hi Andy, On Fri, Jun 8, 2012 at 1:44 PM, Andy L wrote: > On 06/07/2012 09:22 PM, Ambrose Bonnaire-Sergeant wrote: > >> Every Seqable is not Sequential. >> >> (sequential? {:a 1

Re: why String is not a collection (of Character)

2012-06-07 Thread Ambrose Bonnaire-Sergeant
Hi Andy, On Fri, Jun 8, 2012 at 1:44 PM, Andy L wrote: > On 06/07/2012 09:22 PM, Ambrose Bonnaire-Sergeant wrote: > >> Every Seqable is not Sequential. >> >> (sequential? {:a 1}) => false >> > > Is there a simple test for sequable? No. I assume you mean seqable. If it did exist, it would look

Re: why String is not a collection (of Character)

2012-06-07 Thread Cédric Pineau
2012/6/8 Andy L > > Is there a simple test for sequable? seq? -- Cédric -- 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 pa

Re: why String is not a collection (of Character)

2012-06-07 Thread Andy L
On 06/07/2012 09:22 PM, Ambrose Bonnaire-Sergeant wrote: Every Seqable is not Sequential. (sequential? {:a 1}) => false Is there a simple test for sequable? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloju

Re: why String is not a collection (of Character)

2012-06-07 Thread Ambrose Bonnaire-Sergeant
Hi Tim, On Fri, Jun 8, 2012 at 12:11 PM, Tim Visher wrote: > > 2. While I would very much expect the type test (coll? seq?) to return > false on a string, I would _not_ expect the capability test > (sequential?) to return false, and it does for a String. Is this the > expected behavior? I would

Re: why String is not a collection (of Character)

2012-06-07 Thread Tim Visher
Hi Andy, On Thu, Jun 7, 2012 at 7:54 PM, Andy Coolware wrote: > I was wondering cause we can do all awesome stuff like that: > > user=> (last "abc") > \c > user=> (first "abc") > \a > user=> (map (fn[z] (str z "-")) "abc") > ("a-" "b-" "c-") > > but this renders false > > user=> (coll? "abc") > f

Re: why String is not a collection (of Character)

2012-06-07 Thread Ambrose Bonnaire-Sergeant
Hi Andy, Many collection functions call "seq" on their arguments, therefore those expect a Seqable (or a String, Iterable, Array, java.util.Map etc.), not an IPersistentCollection (which coll? tests for). Working these things out can get subtle. Thanks, Ambrose On Fri, Jun 8, 2012 at 7:54 AM, A

Re: why String is not a collection (of Character)

2012-06-07 Thread Andy Coolware
I was wondering cause we can do all awesome stuff like that: user=> (last "abc") \c user=> (first "abc") \a user=> (map (fn[z] (str z "-")) "abc") ("a-" "b-" "c-") but this renders false user=> (coll? "abc") false A. -- You received this message because you are subscribed to the Google Groups

Re: why String is not a collection (of Character)

2012-06-07 Thread James Reeves
On 7 June 2012 07:03, Andy Coolware wrote: > So my questions is as in subject. I did a bit of research but could not find > a good answer. Because otherwise Clojure wouldn't be compatible with Java APIs. It would also probably be slower than using the native String class. - James -- You receiv

Re: why String is not a collection (of Character)

2012-06-07 Thread Evan Mezeske
How would that affect Java interop? It seems like it would make Clojure strings incompatible with Java functions that take strings as arguments. On Wednesday, June 6, 2012 11:03:11 PM UTC-7, Andy C wrote: > > Hi, > > So my questions is as in subject. I did a bit of research but could not > find

why String is not a collection (of Character)

2012-06-07 Thread Andy Coolware
Hi, So my questions is as in subject. I did a bit of research but could not find a good answer. Would appreciate an insight ... (thank you 'Andy) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegro