liveBook · Manning

Greater-than operator

As explained in Clojure: The Essential Reference

The Clojure numeric comparison operator that returns true when its arguments are strictly decreasing from left to right.

The Clojure greater-than operator tests strict numeric decrease from left to right. It returns true when every adjacent pair satisfies the ordering; equality makes the result false. section 6.3

Use these arity and input rules:

  • With one argument, returns true for any value. section 6.3
  • With two or more arguments, requires every argument to be numeric and checks each left-to-right relationship. section 6.3
  • Calling it without arguments raises ArityException; a nonnumeric multi-argument value raises ClassCastException. section 6.3

Ordering a sequence

(sort > (range 10)) ;; (9 8 7 6 5 4 3 2 1 0)

How Clojure: The Essential Reference covers it

How deep it goes
Defines arities, numeric contracts, return values, exceptions, and adjacent comparisons without implementation internals.
Examples
Demonstrates descending sorting over a numeric range.
What it assumes
Assumes basic Clojure function calls and numeric values while defining ordering and numeric-input rules.
What you can do after
Apply it via sort to arrange values in descending order.
How it connects
Connects numeric comparison with ordering predicates, sorting, partial application, and apply.

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.