Ramda Relation Methods

Beginner
7 min read
Updated: Nov 2026
25 method guides
Method index

About This Index

This page is the Ramda Relation index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.

Learn the Ramda overview on /ramdajs. Use this page when you need a relation API such as R.equals(), R.union(), or R.sortBy().

Beginner path.

Start with R.equals(), then R.gt() / R.lt(), R.union(), and R.sortBy()—add set ops with custom matchers as needed.

How to Call a Relation Method

Import R (or a named helper)—compare, order, and combine with data last:

Ramda
const R = require("ramda");

R.equals({ a: 1 }, { a: 1 });          // true
R.identical(NaN, NaN);                 // true
R.gt(5, 3);                            // true
R.min(5, 3);                           // 3
R.clamp(1, 10, 15);                    // 10

R.union([1, 2], [2, 3]);               // [1, 2, 3]
R.intersection([1, 2], [2, 3]);        // [2]
R.difference([1, 2, 3], [2]);          // [1, 3]

R.sortBy(R.prop("age"), [
  { name: "Bob", age: 30 },
  { name: "Ada", age: 25 }
]);                                    // Ada then Bob

R.propEq("id", 1, { id: 1 });          // true

Ramda Relation Methods Table

All Relation method guides in this Ramda tutorial series (25 tutorials).

Getting Started

4 methods

Equality, identity, custom compare, and clamp — the foundation of a Ramda relation tutorial.

MethodDescriptionTutorial
R.equals()Deep value equality for objects, arrays, and primitives. The default match test for set helpers.Try it
R.identical()Strict SameValue equality (===). Use when reference or primitive identity matters, not deep structure.Try it
R.eqBy()Compare two values after running the same function on each. Ideal for sorting or matching by a key.Try it
R.clamp()Restrict a value to an inclusive min–max range. Returns min, max, or the value unchanged.Try it

Compare & Pick

8 methods

Ordering tests and min/max helpers for numbers, strings, dates, and projected keys.

MethodDescriptionTutorial
R.gt()Return true when the first ordered value is greater than the second.Try it
R.gte()Return true when the first ordered value is greater than or equal to the second.Try it
R.lt()Return true when the first ordered value is less than the second.Try it
R.lte()Return true when the first ordered value is less than or equal to the second.Try it
R.min()Return the smaller of two ordered values.Try it
R.max()Return the larger of two ordered values.Try it
R.minBy()Pick the item whose projected value is smallest. Uses a function to compare by key.Try it
R.maxBy()Pick the item whose projected value is largest. Uses a function to compare by key.Try it

Property Equality

2 methods

Build predicates that match one property or nested path on an object.

MethodDescriptionTutorial
R.propEq()Build a predicate that checks whether one property equals a value.Try it
R.pathEq()Build a predicate that checks whether a nested path equals a value.Try it

Set Operations

7 methods

Difference, intersection, union, and symmetric difference with value or custom matching.

MethodDescriptionTutorial
R.difference()Return items in the first list that are not in the second, using R.equals for matching.Try it
R.differenceWith()Like R.difference but with a custom predicate to decide when two items match.Try it
R.intersection()Return unique items that appear in both lists, using R.equals for matching.Try it
R.union()Return unique items from either list, deduped with R.equals. First-list order wins.Try it
R.unionWith()Like R.union but with a custom predicate to decide when two items match.Try it
R.symmetricDifference()Return items in either list but not in both, using R.equals for matching.Try it
R.symmetricDifferenceWith()Like R.symmetricDifference but with a custom match predicate.Try it

Sort

2 methods

Order lists by a computed key or by a stack of comparators.

MethodDescriptionTutorial
R.sortBy()Sort a list by a computed key. Stable ascending order by the accessor result.Try it
R.sortWith()Sort a list using a list of comparator functions tried in order.Try it

Join & Count

2 methods

Pair lists on a shared key or tally items grouped by a bucket function.

MethodDescriptionTutorial
R.innerJoin()Join two lists on a shared key, producing pairs of matching items.Try it
R.countBy()Group list items by a key function and count how many fall in each bucket.Try it

Frequently Asked Questions

They are curried helpers for comparing values, ordering data, matching object properties, combining lists as sets, sorting, joining, and counting—R.equals, R.gt, R.union, R.propEq, R.sortBy, and more.
R.equals does deep value equality for objects and arrays. R.identical uses strict SameValue equality (===), so two different object references never match even with the same contents.
R.union returns unique items from either list. R.intersection returns only items that appear in both. Both use R.equals by default.
R.propEq checks one top-level property against a value. R.pathEq checks a nested path such as ['user', 'id']. Both return reusable predicates.
Start with R.equals(), then R.gt() / R.lt(), R.union(), and R.sortBy() from the table below.

Start with R.equals()

Open the equals guide—syntax, examples, and FAQs.

R.equals() tutorial →

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.

16 people found this page helpful