Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Jan 31 2019 22:17
    CrossEye commented #2779
  • Jan 31 2019 21:04
    ArturAralin commented #2779
  • Jan 31 2019 20:08
    CrossEye commented #2779
  • Jan 31 2019 18:56
    buzzdecafe commented #2631
  • Jan 31 2019 18:09
    ArturAralin commented #2779
  • Jan 31 2019 16:18
    CrossEye commented #2779
  • Jan 31 2019 16:10
    CrossEye commented #2631
  • Jan 31 2019 16:06
    CrossEye commented #2777
  • Jan 31 2019 14:44
    ArturAralin opened #2779
  • Jan 31 2019 07:39
    inferusvv commented #2631
  • Jan 31 2019 03:07
    sespinozj commented #2771
  • Jan 31 2019 02:33
    machad0 commented #2771
  • Jan 31 2019 02:26
    JeffreyChan commented #2777
  • Jan 30 2019 14:30
    CrossEye closed #2777
  • Jan 30 2019 12:13
    vanyadymousky updated the wiki
  • Jan 30 2019 01:42
    JeffreyChan commented #2777
  • Jan 29 2019 21:06
    vanyadymousky updated the wiki
  • Jan 29 2019 16:28
    CrossEye commented #2777
  • Jan 29 2019 15:50
    mbostock commented #2772
  • Jan 29 2019 15:48
    CrossEye commented #2772
Rodrigo Álvarez
it expects functions
I guess R.always can accept any number of arguments and won't complain
so, the argument you pass at the end (0, 100, whatever) is used to call the transformers
and in this case, the transformers do nothing except return R.filter(isEven, array) or 'water boils at 100°C'
Rodrigo Álvarez
@amirbr :point_up:
Brad Compton (he/him)

@amirbr Always is used basically to turn a value into a function to return that value.

R.filter(isEven, array) is evaluated at the time the function fn invoved, returning an Array. Then, after that, 0 is passed into R.cond([...]) at which point it starts checking the conditions.

R.equals(0)(0) is then evaluated, and returns true. As a result, the second item in the pair, R.filter(isEven, array), now evaluated to [2, 4], is retrieved as the function to invoke.

At that point, cond will try to call that function, actually an array, and return the error you experienced.

But this is where I might ask why you are using cond in this way. It's best case is to allow for lazy execution of the branches. In the general case if you pass in a function it will only be evaluated if its guard returns true. By pre-filltering the Array and wrapping the result in Always you force the function to be run every time fn is called regardless of whether the condition holds.
Michael Weichert
Hey all. I was just wondering if anyone has thoughts about when you use Fluture and when to use something like Highland? Both can be used instead of promises, and provide the ability to map/filter/reduce, etc.
Highland, like Fluture, both implement static land compatible methods as well.
Brad Compton (he/him)
I think Highland is a streaming project mainly though right? I haven't heard much about it for the last few years, is t still used / maintained?
@Bradcomp @Papipo thank you so much you are amazing :)
Ilya Sevostyanov

how i can replace neededAlternativeByRamda function by native Ramda function call or combination of calls ?

const neededAlternativeByRamda = (args, func) => arg => func(...args.map(a => (a === R.__ ? arg : a)))

// example of IRL usage
      const newEditorState = R.pipe(
        neededAlternativeByRamda([editorState, R.__, 'change-block-data'], EditorState.push),

I need this for convenient inclusion in the pipe, for use argument that descent on this pipe to functions that have more wide signature that only one argument, and target argument will be placed in arbitrary order in total arguments (replaces R.__ from array of arguments that defined at call)
I think this is good idea and will look good

Maurizio Pucci
how to write this :
const res = x => fn1(x) || fn2(x)
// in
const resFn = or(f1, f2)
const res = resFn(x)
Ben Briggs
@devmao Check out R.either
Hello, I've a problem in ramda and need. your help please
(2) [Array(2), Array(2)]
0: (2) ["["Bmw"]", "["Fiat"]"]
1: (2) ["{"locations":[{"label":"Toute la France"}]}", "{}"]
length: 2
__proto__: Array(0)
I have an array composed of two arrays and i would like to filter the data to only get the item which not contains the word "Toute la France"
What I would like for that exemple is to filter only the first item
I tried includes method but on another cases, I can have an array with undefined values and Includes throws an error ===> canno't find indexOf undefined
const arr = [undefined, undefined] !R.includes('Toute la France', ...arr)
that one doesn't work
Nikolaus Fedurko

Hello, it may be foolish question, but what are the reason of making _arity and, consequently, _curryN accept functions that accept only up to 10 args?

From https://github.com/ramda/ramda/blob/master/source/internal/_arity.js :

default: throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
John Hartnup
I would guess that JS doesn't give you a way to programatically create a function with an arbitrary number of parameters. Hence they've had to hard-code an implementation of every option from 0 params to 10. I guess they thought "10 should be enough for anyone".
Of course, they could add a line for 11 params, but then you'd be asking why not 12. For some reason I'm reminded of https://en.wikipedia.org/wiki/Hilbert%27s_paradox_of_the_Grand_Hotel
@raine, I can give you some big files privately. I can't and won't post them as they contain personal preference information.
Maurizio Pucci
project.crews.forEach(c => c.calendar.forEach(w => { acc.Workweek[project.calendarWorkweekById[w.calendarWorkweekId].name] = true; })); better?
Brad Compton (he/him)

:point_up: In some environments you can't create a function with an arbitrary set of parameters. There have been discussions on this before. I will see if I can pull them up.

I think we can revisit this in the future though.

Brad Compton (he/him)
@/all If you are interested in discussing the direction of Ramda with respect to type checking and error messages, please chime in over on this issue: ramda/ramda#2998
Hi guys! I've created simple interactive tutorial based on Randy Coulman's blog: Thinking in Ramda. Try it out: https://github.com/zolbooo/ramda-learning
Tips and advices are welcome 😉
@zolbooo, you are giving instructions to start npm install; npm start. I would also give some information on what the learning format looks like. What people can expect when taking the lesson.
Also, I'm getting the following error:
1:11:03 AM - Found 0 errors. Watching for file changes.
-- Getting started --

⛔️ Test "map: double array" was not passed
TypeError: doubleArray is not a function
    at Object.test (/home/women/projects/ramda-learning/prod/getting_started.js:18:24)
Got it, thank you for your feedback!
You should edit code to pass all tests in sections.
Aadi Deshpande

hi, i’m trying to figure out the best way to tackle this:
i have an object
{ firstName: 'Joe', lastName: 'Schmoe', age: 25, weight: 160 }
that I need to add another property to which combines a few properties into a new property and then adds that to the resulting object.
this is the last chain of a pipe:
pipe(… , <my method>)
The best way I’ve come up with so far is to use converge with assoc and identity:
pipe(… , converge( assoc('proposedLogin'), [ (s) => `${s.firstName}${s.lastName}${s.age}`, identity ] )

but i get the sense that there’s a better way that I’m not aware of

Vladimir Kapustin
@cilquirm you could use chain for this:
// getProposedLogin :: Object -> String
const getProposedLogin = o(
  join( '' ),
  props( [ 'firstName', 'lastName', 'age' ] )

// addProposedLogin :: Object -> Object
const addProposedLogin = chain(

const pipeline = pipe(
ap and chain take up nicely the cases seemingly meant for converge, where there are just two functions and one of them is identity.
Vladimir Kapustin
ap gives you ap (f, g) (a) = f (a) (g (a)) and chainchain (f, g) (a) = f (g (a)) (a)
Vladimir Kapustin
:point_up: addPropertyLogin should be:
// addProposedLogin :: Object -> Object
const addProposedLogin = chain(
Johnny Hauser
I feel like I mostly understand transducers, but there's one case that blew up my brain and I'm having trouble getting through it... with the idea of transducing a reactive type, like an frp event/stream kind of thing - it's pretty straightforward that you start with a stream, each value from it goes through the pipeline, and there's a builder on the end pushing the transformed value into the resulting stream. I don't think I have an issue with my mental model here. But when I approach the idea of a fold on an event/stream, I am lost.
eventStream.fold((acc, v) => [ ...acc, v ], [])
what would that mean with transducers?
Johnny Hauser
I think it would be like [ 1, 2, 3 ] to [ [ 1 ], [ 1, 2 ], [ 1, 2, 3 ] ]
John Hartnup
@kapooostin @cilquirm , this is great. I've got a function I use often that isn't written in Ramda, but I use from Ramda a lot:
const assocDerived = (name, f, obj) => ({
  [name]: f(obj),
(Wrap it in curry() ... I left it off for brevity)
But I may start using chain instead.
Aadi Deshpande
thank you so much @kapooostin. this completely opened my :eyes:
Johnny Hauser
I came across the statement 'transducers are perverse lenses', but I don't understand anything said on that topic, of which there is little. Transducers can be used on push-based reactive types. Can lenses be used for such things instead?

I have been using a few functions from Ramda for a while but this is my first
time using transduce.

The sample is some data and code from a Ract app. There is a stripped-down
version of the React app at: https://codesandbox.io/s/data-with-ramda-38j7b

The code is building a table and applies formatting when a dataField has a formatFn property.

It is expected to process about 1,000 objects/rows, each with 14 properties and maybe 7 of them having a formatFn property.

It works as is but I am wondering if there is a better way to make use of Ramda to make the code more efficient?


    const data = [
        _id: "1234",
        date: "2020-01-23T08:00:00.000Z",
        description: "ATM CHECK DEPOSIT",
        debit: 0,
        credit: 91.5,
        omit: false
        _id: "5678",
        date: "2020-02-10T08:00:00.000Z",
        description: "CHEVRON",
        debit: -63.51,
        credit: 0,
        omit: true

    const columns = ["_id", "date", "description", "credit", "debit", "omit"];

    const dataFields = {
      _id: {
        name: "_id",
        description: "Id"
      date: {
        name: "date",
        description: "Date",
        formatFn: d => `++${d}` // actual format is from date-fns
      description: {
        name: "description",
        description: "Description"
      credit: {
        name: "credit",
        description: "Credidt"
      debit: {
        name: "debit",
        description: "Debit"
      omit: {
        name: "omit",
        description: "Omit",
        formatFn: d => (d ? "yes" : "no")


    const modValues = (value, key, obj) => {
      const column = dataFields[key];
      if (has("formatFn")(column)) {
        const { formatFn } = column;
        return formatFn(value);
      } else {
        return value;

    const _transform = map(mapObjIndexed(modValues));
    transduce(_transform, flip(append), [], data);