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 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 can see, with > defined as it is you get the win that >> >> (> 10 9 8 7 6 5) >> >> works sensible but get a counter-intuitive behaviour for >> >> (> 1) > > 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.
In the source code, which is available here http://clojuredocs.org/clojure_core/clojure.core/%3E the value for one argument is set to true: (defn > "Returns non-nil if nums are in monotonically decreasing order, otherwise false." {:inline (fn [x y] `(. clojure.lang.Numbers (gt ~x ~y))) :inline-arities #{2} :added "1.0"} ([x] true) ([x y] (. clojure.lang.Numbers (gt x y))) ([x y & more] (if (> x y) (if (next more) (recur y (first more) (next more)) (> y (first more))) false))) Alan -- 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 this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.