Ramda.js R.lt() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Relation

Definition

Ramda’s R.lt() answers an ordering question: is the first value strictly less 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.gt, 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.intersection. Next is R.lte.

The official samples cover the whole idea. R.lt(2, 1) is false. R.lt(2, 2) is false — strict less-than, not <=. R.lt(2, 3) is true. Strings compare lexicographically: R.lt('a', 'z') is true; R.lt('z', 'a') is false.

Syntax

Call R.lt. Start with this line.

Ramda
R.lt(a, b)
CallWhat it does
R.lt(a, b)Primary signature.
R.lt(...)Call the relation helper.

Prefer import { lt } from "ramda" when you want a named import.

Library declarations
Ramda
R.lt(a, b)

Parameters

ParameterDescription
aRequired. Ord. First value — must be less than b for true. Not mutated.
bRequired. Ord. Second value to compare against. Not mutated.

Return Value

Return ValueDescription
Booleantrue when a < b. false when equal or greater. 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 less-than: equal pairs return false.

Ramda
R.lt(2, 1);
//=> false

R.lt(2, 2);
//=> false

R.lt(2, 3);
//=> true

R.lt('a', 'z');
//=> true

R.lt('z', 'a');
//=> false
Try It Yourself

How It Works

That is the docs sample from ramdajs.com. 2 < 3 is true. 2 < 2 is false because R.lt is strict, not <=. Strings compare lexicographically: 'a' < 'z' is true.

Example 2 — vs R.gt, 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. Note R.lt(2, 2) is false while R.lte(2, 2) is true.

Ramda
R.gt(2, 2);  R.lt(2, 2);  R.gte(2, 2);  R.lte(2, 2);
//=> false    //=> false    //=> true     //=> true

R.gt(2, 3);  R.lt(2, 3);  R.gte(2, 3);  R.lte(2, 3);
//=> false    //=> true     //=> false    //=> true
Try It Yourself

How It Works

On equal pairs, only R.gte and R.lte return true because they are inclusive. R.lt(2, 2) is false but R.lte(2, 2) is true — that is the strict vs inclusive split. On (2, 3), R.lt and R.lte return true because 2 is less than or equal to 3.

📈 Practical Patterns

Curried filters with placeholder, record predicates with R.propSatisfies, then earlier Date ordering.

Example 3 — Curried Filter with R.lt(R.__, 10)

Fix the upper bound with the placeholder. The result is a one-argument predicate for R.filter that keeps values strictly below 10.

Ramda
R.filter(R.lt(R.__, 10), [3, 6, 9, 12, 4]);
//=> [3, 6, 9, 4]
Try It Yourself

How It Works

R.lt(R.__, 10) waits for the first argument. R.filter passes each list element. Only values strictly less than 10 pass. 12 is excluded; 10 itself would also fail because R.lt is strict.

Example 4 — R.propSatisfies with R.lt(R.__, 18)

Build a record predicate that checks whether a user’s age is strictly below a threshold.

Ramda
const isUnder18 = R.propSatisfies(R.lt(R.__, 18), 'age');

R.filter(isUnder18, [
  { name: 'Ada', age: 16 },
  { name: 'Bob', age: 18 },
  { name: 'Cy', age: 21 }
]);
//=> [{ name: 'Ada', age: 16 }]
Try It Yourself

How It Works

R.propSatisfies reads age from each record and passes it to R.lt(R.__, 18). Only Ada’s age of 16 is strictly less than 18. Bob at exactly 18 fails because R.lt is strict — use R.lte when equal should pass.

Example 5 — Earlier Date Comparison

Dates are ordered by their time values. January 2024 is before June 2024.

Ramda
R.lt(new Date('2024-01-01'), new Date('2024-06-01'));
//=> true
Try It Yourself

How It Works

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. The first date is earlier, so R.lt returns true.

Browser Support

R.lt() 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.lt()

Load Ramda 0.1.0 or later via CDN or npm, then call R.lt with two ordered values. No extra browser API is required.

100% With Ramda 0.1.0+
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
R.lt() 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.lt(a, b) returns true when the first argument is strictly less than the second, false otherwise. Type: Ord a => a → a → Boolean. Arity 2, curried. Added in v0.1.0.
R.lt(2, 1) is false. R.lt(2, 2) is false. R.lt(2, 3) is true. R.lt('a', 'z') is true. R.lt('z', 'a') is false.
R.lt is strict less-than (<). R.lte is less-than-or-equal (<=). R.lt(2, 2) is false; R.lte(2, 2) is true.
R.equals tests deep value equality and returns true when values match. R.lt tests ordering and returns true only when the first value is strictly less than the second.
Yes. Any ordered type that JavaScript can compare with < works — numbers, strings (lexicographic), and Dates (by time value).
No. R.lt is a stable Ramda relation helper from v0.1.0. It is not deprecated, experimental, or non-standard.

Continue to R.lte()

Learn inclusive less-than-or-equal ordering and how R.lte(2, 2) differs from strict R.lt.

R.lte() Method →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful