This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-24
Channels
- # announcements (1)
- # babashka (86)
- # beginners (75)
- # boot-dev (1)
- # cljdoc (18)
- # cljs-dev (1)
- # cljsrn (67)
- # clojure (127)
- # clojure-australia (1)
- # clojure-dev (2)
- # clojure-europe (9)
- # clojure-nl (2)
- # clojure-serbia (2)
- # clojure-spec (11)
- # clojure-uk (14)
- # clojurescript (17)
- # code-reviews (4)
- # conjure (37)
- # core-async (11)
- # datomic (21)
- # emacs (1)
- # helix (36)
- # jobs (6)
- # malli (1)
- # meander (20)
- # re-frame (13)
- # reagent (49)
- # remote-jobs (11)
- # rum (1)
- # sci (1)
- # shadow-cljs (29)
- # sql (17)
- # vim (2)
While the following is less efficient, it is more readable (to me), because it manipulates sequences in smaller steps, as opposed to merging those steps into one loop:
(defn minimum-absolute-difference [xs]
(->> (sort xs)
(partition 2 1)
(map (fn [[x y]] (Math/abs (- x y))))
(apply min)))
Also, all classes in java.lang
are imported and referred by ns
. So, you can use Math/abs
in addition to the full name java.lang.Math/abs
it's not ns that does the scoping, but yes, most of java.lang is automatically in scope

I always thought it was ns
. Perhaps i'm confusing the import of java.lang
with the requiring and referring of things in clojure.core
Edit: sorry for the misleading statement earlier.