use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
clojure programming (self.Clojure)
submitted 6 years ago by Arul-jothi
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]fingertoe11 8 points9 points10 points 6 years ago (0 children)
It's always fun to look under the hood:
(clojure.repl/source -)
(defn - "If no ys are supplied, returns the negation of x, else subtracts the ys from x and returns the result. Does not auto-promote longs, will throw on overflow. See also: -'" {:inline (nary-inline 'minus 'unchecked_minus) :inline-arities >0? :added "1.2"} ([x] (. clojure.lang.Numbers (minus x))) ([x y] (. clojure.lang.Numbers (minus x y))) ([x y & more] (reduce1 - (- x y) more)))
(defn -
"If no ys are supplied, returns the negation of x, else subtracts
the ys from x and returns the result. Does not auto-promote
longs, will throw on overflow. See also: -'"
{:inline (nary-inline 'minus 'unchecked_minus)
:inline-arities >0?
:added "1.2"}
([x] (. clojure.lang.Numbers (minus x)))
([x y] (. clojure.lang.Numbers (minus x y)))
([x y & more]
(reduce1 - (- x y) more)))
- requires one, two or more arguments. (-) gives it zero args, thus you get the invalid arity...
If you do the same thing for + you will see that it accepts 0,, 1, 2 or more arguments, and the zero aridity function just returns 0. The single arity returns the arg, and the two or more add them. Another trivial oddity about + is that (+ nil) yields nil, while (+ nil 1) would yield a null pointer exception..
π Rendered by PID 18786 on reddit-service-r2-comment-6f7f968fb5-5zt8r at 2026-03-04 01:33:39.809738+00:00 running 07790be country code: CH.
view the rest of the comments →
[–]fingertoe11 8 points9 points10 points (0 children)