Re: why ( 2) returns true

2014-09-17 Thread Phillip Lord
Robert Tweed fistful.of.spann...@gmail.com 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

Re: why ( 2) returns true

2014-09-17 Thread Herwig Hochleitner
2014-09-17 11:51 GMT+02:00 Phillip Lord phillip.l...@newcastle.ac.uk: 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

Re: why ( 2) returns true

2014-09-17 Thread Phillip Lord
Herwig Hochleitner hhochleit...@gmail.com writes: 2014-09-17 11:51 GMT+02:00 Phillip Lord phillip.l...@newcastle.ac.uk: 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

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 phillip.l...@newcastle.ac.uk wrote: Herwig Hochleitner hhochleit...@gmail.com writes: 2014-09-17 11:51 GMT+02:00

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 Phillip Lord
Same argument applies (er...) to the zero element case. Phil Ashton Kemerling ashtonkemerl...@gmail.com 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

Re: why ( 2) returns true

2014-09-16 Thread Robert Tweed
On 15/09/2014 13:34, Phillip Lord wrote: Jeremy Vuillermet jeremy.vuiller...@gmail.com 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

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 from

Re: why ( 2) returns true

2014-09-15 Thread Alan Forrester
On 15 September 2014 08:46, Jeremy Vuillermet jeremy.vuiller...@gmail.com 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

Re: why ( 2) returns true

2014-09-15 Thread Phillip Lord
Jeremy Vuillermet jeremy.vuiller...@gmail.com 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

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

Re: why ( 2) returns true

2014-09-15 Thread Alan Forrester
On 15 September 2014 13:44, Kalina Todorova kalinalyudmil...@gmail.com wrote: On Mon, Sep 15, 2014 at 2:34 PM, Phillip Lord phillip.l...@newcastle.ac.uk wrote: Jeremy Vuillermet jeremy.vuiller...@gmail.com writes: Could it return a (partial 2) ? Because works with n args and not

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

Re: why ( 2) returns true

2014-09-15 Thread Phillip Lord
Jeremy Vuillermet jeremy.vuiller...@gmail.com 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.

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