Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.
David Zukowski edited this page Jun 22, 2016 · 4 revisions

Welcome to the redash wiki!

Redash vs. Ramda

Philosophy

Ramda aims to be as true to functional languages, such as Haskell, as possible. They have also done extensive work to make it compatible with higher-minded libraries such as ramda-fantasy. This is great, and Ramda has done a fantastic job in this regard, but it is unnecessary for many of the popular JavaScript coding styles. Redash tries to take a middle ground by nudging JavaScript closer to a more pure functional language, but stopping at that. When entering the land of Functors, Applicatives, Monads, et al., I find it makes more sense to use a language built around those constructs rather than working with suboptimal implementations in a dynamic language.

Code Style

Redash, in contrast to Ramda, sacrifices some terseness and DRYness in the implementation of internal functions. For example, there are many functions offered by the Redash API that could be implemented by composing other pieces of the API (i.e. reject can be implemented with filter and complement). While the Redash approach is less elegant, it's often more performant due to lower overhead for iterations and fewer function calls.

equals

Redash, by default, uses referential equality. This means that if you have two identical objects, but they occupy a different space in memory (i.e. they were defined at different times) they will not be considered equal. The reason for this is primarily speed, since the alternative is to perform deep comparisons over potentially large objects. In my experience referential equality works for most use cases, and therefore it does not hurt to make deep comparisons opt-in. Ramda takes the alternate approach by performing deep comparisons by default to determine equality.

not

In Ramda, not simply casts a value to a boolean and inverts it (i.e. '' -> !'' -> true). Redash does the exact same, except when the provided value is a function. In this event, it returns a function (curried to the same arity as the original) that, when invoked, calls the original function and inverts its return value. In Ramda, this exists as a separate method called complement.

Clone this wiki locally