Re: (flatten non-sequential) has a surprising result

2015-07-02 Thread J . Pablo Fernández
Yes, reading the source code and trying to understand why rest was being called there is how I came up with this case. On 2 July 2015 at 07:54, icamts wrote: > Hi Pablo, > I think you're right. Have a look at flatten source > > (defn flatten > "Takes any nested combination of sequential things

Re: (flatten non-sequential) has a surprising result

2015-07-01 Thread icamts
Hi Pablo, I think you're right. Have a look at flatten source (defn flatten "Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns an empty sequence." {:added "1.2" :static true} [x] (fil

Re: (flatten non-sequential) has a surprising result

2015-07-01 Thread J . Pablo Fernández
I agree with you Mikera, it also maintains the homogeneity of always returning a sequence but some people disagreed with it, so an error might be better. -- J. Pablo Fernández http://pupeno.com On Jul 1, 2015 4:22 PM, "Mikera" wrote: > On Wednesday, 1 July 2015 12:55:28 UTC+1, J. Pablo Fernánde

Re: (flatten non-sequential) has a surprising result

2015-07-01 Thread Mikera
On Wednesday, 1 July 2015 12:55:28 UTC+1, J. Pablo Fernández wrote: > > Hello Clojurists, > > Today I was surprised by the result of (flatten 1) which is '(). I was > expecting '(1) or an error. Talking in some other people in #clojure @ > clojurians.net, not everybody agrees that '(1) is a good

(flatten non-sequential) has a surprising result

2015-07-01 Thread J . Pablo Fernández
Hello Clojurists, Today I was surprised by the result of (flatten 1) which is '(). I was expecting '(1) or an error. Talking in some other people in #clojure @ clojurians.net, not everybody agrees that '(1) is a good result but that '() is somewhat surprising. Would it be better if it raised an