Re: why (> 2) returns true

2014-09-17 Thread Phillip Lord
Same argument applies (er...) to the zero element case. Phil Ashton Kemerling writes: > I wouldn't be surprised if the 1 arg form is to help people who use > along > with apply, just in case the list is only 1 element long. > > On Wed, Sep 17, 2014 at 7:40 AM, Phillip Lord > wrote: > >> Herwi

Re: why (> 2) returns true

2014-09-17 Thread Robert Tweed
On 17/09/2014 15:28, Ashton Kemerling wrote: I wouldn't be surprised if the 1 arg form is to help people who use > along with apply, just in case the list is only 1 element long. That is precisely why it should do the same thing with zero arguments, which is what happens when you use apply with

Re: why (> 2) returns true

2014-09-17 Thread Ashton Kemerling
I wouldn't be surprised if the 1 arg form is to help people who use > along with apply, just in case the list is only 1 element long. On Wed, Sep 17, 2014 at 7:40 AM, Phillip Lord wrote: > Herwig Hochleitner writes: >> 2014-09-17 11:51 GMT+02:00 Phillip Lord : >> >>> >>> So, why not special ca

Re: why (> 2) returns true

2014-09-17 Thread Phillip Lord
Herwig Hochleitner writes: > 2014-09-17 11:51 GMT+02:00 Phillip Lord : > >> >> So, why not special case 1 arg as well, and have that except? It's a >> reasonable question. I would submit a bug report and see if anyone else >> agrees. Something is wrong for sure. Either (> x) should throw arity, o

Re: why (> 2) returns true

2014-09-17 Thread Herwig Hochleitner
2014-09-17 11:51 GMT+02:00 Phillip Lord : > > So, why not special case 1 arg as well, and have that except? It's a > reasonable question. I would submit a bug report and see if anyone else > agrees. Something is wrong for sure. Either (> x) should throw arity, or > (>) should return true, or the d

Re: why (> 2) returns true

2014-09-17 Thread Phillip Lord
Robert Tweed writes: > In writing this, I thought I'd better also test what (>) and (<) evaluate to, > because by the above definition, those should also evaluate to true. > Unfortunately, at least in v1.6, they throw an arity error. IMO, by the same > logic that says a single argument is valid,

Re: why (> 2) returns true

2014-09-16 Thread Robert Tweed
On 15/09/2014 13:34, Phillip Lord wrote: Jeremy Vuillermet writes: Could it return a (partial > 2) ? Because > works with n args and not just two. The question was /why/ and yours is the best attempt to answer that, but I think, slightly off the mark. Firstly, the fact that > is variadic d

Re: why (> 2) returns true

2014-09-15 Thread Paweł Sabat
No marco is returned. => (type (> 2)) java.lang.Boolean And from here https://github.com/clojure/clojure/blob/028af0e0b271aa558ea44780e5d951f4932c7842/src/clj/clojure/core.clj#L1029 you can see, that with one parameter, there is always returned true. noniwoo 2014-09-15 9:46 GMT+02:00 Jeremy Vu

Re: why (> 2) returns true

2014-09-15 Thread Phillip Lord
Jeremy Vuillermet writes: > Thanks, that' clearer. > Also I didn't take time to read the docstring > "Returns non-nil if nums are in monotonically decreasing order, > otherwise false." > > so I guess [2] is monotonically decreasing and increasing at the same > time. Yeah, so the same list

Re: why (> 2) returns true

2014-09-15 Thread Jeremy Vuillermet
Thanks, that' clearer. Also I didn't take time to read the docstring "Returns non-nil if nums are in monotonically decreasing order, otherwise false." so I guess [2] is monotonically decreasing and increasing at the same time. Maybe I just read too much about transducers and now I try -1 ari

Re: why (> 2) returns true

2014-09-15 Thread Alan Forrester
On 15 September 2014 13:44, Kalina Todorova wrote: > On Mon, Sep 15, 2014 at 2:34 PM, Phillip Lord > wrote: >> >> >> >> Jeremy Vuillermet writes: >> >> > Could it return a (partial > 2) ? >> >> >> Because > works with n args and not just two. >> >> (> 2) => (partial > 2) >> >> then why not >> >

Re: why (> 2) returns true

2014-09-15 Thread Kalina Todorova
I didn't actually think that they have actually hard-coded it to true. It makes sense from logical stand point to return true but hard-coding it I am not sure that is the best approach here. Best regards | Med venlig hilsen, KALINA TODOROVA T: 0045 52 64 93 73 E: ad...@ki6i.com Frederikssunds

Re: why (> 2) returns true

2014-09-15 Thread Phillip Lord
Jeremy Vuillermet writes: > Could it return a (partial > 2) ? Because > works with n args and not just two. (> 2) => (partial > 2) then why not (> 2 3) =? (partial > 2 3) when is the sensible place to stop? Now, if > took at most two args, this would be a sensible thing. As far as I ca

Re: why (> 2) returns true

2014-09-15 Thread Alan Forrester
On 15 September 2014 08:46, Jeremy Vuillermet wrote: > Could it return a (partial > 2) ? http://clojuredocs.org/clojure_core/clojure.core/%3E If you look at the source code near the bottom of the page, you will find that it specifies that when you give > a single argument it always returns true.

why (> 2) returns true

2014-09-15 Thread Jeremy Vuillermet
Could it return a (partial > 2) ? -- 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 patient with your first post. To unsubscribe fr