Some Practical Clojure Examples
← prev | next →     Top-level ToC     /math.html     (printable version)

Prefer what comes with Clojure over raw Java Math/* static methods.

(require '[clojure.math.numeric-tower :as math])
(require '[clojure.math.combinatorics :as combo])

Some functions in math.numeric-tower: ceil, floor, round, sqrt, abs, expt, gcd, & lcm.

Some functions in math.combinatorics: cartesian-product, combinations, permutations, selections, & subsets.

Some of what’s available from java.lang.Math: PI, E, sin, cos, tan, log, log10, etc.