liveBook · Manning

Less-than-or-equal operator

As explained in Clojure: The Essential Reference

The Clojure numeric comparison operator that returns true when its arguments are monotonically increasing from left to right, allowing equality.

Clojure’s <= predicate checks whether arguments are monotonically increasing from left to right, allowing adjacent values to be equal. It returns a Boolean. section 6.3

Use these arities and contracts:

  • With one argument, <= returns true for any type. section 6.3
  • With two or more arguments, every argument must be numeric; integers, decimals, ratios, big numbers, and other Java numeric types are accepted. section 6.3
  • With multiple arguments, each value must be less than or equal to the next; one failed comparison makes the result false. section 6.3
  • Calling it with no arguments raises ArityException; a nonnumeric argument in a multiargument call raises ClassCastException. section 6.3

Chained ordering

Write (<= x y z) to verify x <= y and y <= z together. The variadic form follows the same comparison-operator shape as (<), (>), and (>=). section 6.3

How Clojure: The Essential Reference covers it

How deep it goes
Defines arities, accepted inputs, outputs, ordering semantics, and exceptions without descending into implementation internals.
Examples
Uses comparison-operator signatures and chained multiargument ordering as its primary concrete illustration.
What it assumes
Assumes familiarity with Clojure function calls and numeric values while defining ordering behavior from zero.
What you can do after
Apply it via Clojure’s <= predicate to test ordered numeric arguments, including equal adjacent values.
How it connects
Connects monotonic ordering with numeric equality and the related comparison operators <, >, and >=.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.