Ramda’s R.gt() answers an ordering question: is the first value strictly greater than the second? You pass two ordered values and get back a Boolean. It uses JavaScript’s > operator under the hood, so numbers, strings, and Dates all work. It is not equality — R.equals checks whether values match by deep structure. Cousins R.lt, R.gte, and R.lte cover the other comparison directions. R.max and R.min pick a value rather than return a Boolean. Previous helper is R.equals. Next is R.gte.
The official samples cover the whole idea. R.gt(2, 1) is true. R.gt(2, 2) is false — strict greater-than, not >=. R.gt(2, 3) is false. Strings compare lexicographically: R.gt('z', 'a') is true; R.gt('a', 'z') is false.
Syntax
Call R.gt. Start with this line.
Ramda
R.gt(a, b)
Call
What it does
R.gt(a, b)
Primary signature.
R.gt(...)
Call the relation helper.
Prefer import { gt } from "ramda" when you want a named import.
Library declarations
Ramda
R.gt(a, b)
Parameters
Parameter
Description
a
Required. Ord. First value — must be greater than b for true. Not mutated.
b
Required. Ord. Second value to compare against. Not mutated.
Return Value
Return Value
Description
Boolean
true when a > b. false when equal or less. Always a Boolean, never undefined.
Ramda Examples
📚 Getting Started
The official Ramda samples for numbers and strings.
Example 1 — Official Number and String Samples
Numbers and strings from the Ramda docs. Strict greater-than: equal pairs return false.
That is the docs sample from ramdajs.com. 2 > 1 is true. 2 > 2 is false because R.gt is strict, not >=. Strings compare lexicographically: 'z' > 'a' is true.
Example 2 — vs R.lt, R.gte, R.lte on the Same Pairs
Run all four ordering cousins on (2, 2) and (2, 3) to see strict vs inclusive behavior.
On equal pairs, only R.gte and R.lte return true because they are inclusive. On (2, 3), R.lt and R.lte return true. R.gt is false in both cases here because 2 is not strictly greater.
📈 Practical Patterns
Curried filters with placeholder, Date ordering, then record predicates with R.propSatisfies.
Example 3 — Curried Filter with R.gt(R.__, 5)
Fix the threshold with the placeholder. The result is a one-argument predicate for R.filter.
JavaScript coerces Dates to numbers when compared with >. Ramda delegates to the same operator, so any ordered type works the same way as native comparison.
Example 5 — R.propSatisfies with R.gt(R.__, 0)
Build a record predicate that checks whether a property is strictly positive.
R.propSatisfies reads score from each record and passes it to R.gt(R.__, 0). Only Ada’s score of 10 is strictly greater than zero. Zero and negative values fail the test.
Compatibility
Browser Support
R.gt() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Ramda 0.1.0+ · Any JS runtime
Ramda.js R.gt()
Load Ramda 0.1.0 or later via CDN or npm, then call R.gt with two ordered values. No extra browser API is required.
100%With Ramda 0.1.0+
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
R.gt()Universal
Bottom line: Safe in any project that includes Ramda 0.1.0 or later. Use a CDN build such as ramda.min.js in the browser or install ramda from npm for Node. These labs use [email protected].
Frequently Asked Questions
R.gt(a, b) returns true when the first argument is strictly greater than the second, false otherwise. Type: Ord a => a → a → Boolean. Arity 2, curried. Added in v0.1.0.
R.gt(2, 1) is true. R.gt(2, 2) is false. R.gt(2, 3) is false. R.gt('a', 'z') is false. R.gt('z', 'a') is true.
R.gt is strict greater-than (>). R.gte is greater-than-or-equal (>=). R.gt(2, 2) is false; R.gte(2, 2) is true.
R.equals tests deep value equality and returns true when values match. R.gt tests ordering and returns true only when the first value is strictly greater than the second.
Yes. Any ordered type that JavaScript can compare with > works — numbers, strings (lexicographic), and Dates (by time value).
No. R.gt is a stable Ramda relation helper from v0.1.0. It is not deprecated, experimental, or non-standard.