These are chat archives for ramda/ramda

15th
Jan 2018
Guido Schmitz
@guidsen
Jan 15 2018 07:27

I’m writing a blog post on transducers and just finished my first draft. I’m looking for people that could check the content and grammar (not a native speaker). It would really help me out creating good content for other people in the community.

I've also included a section about RamdaJs :).

Link: https://docs.google.com/document/d/1vJFAQ7JJsKl-E-In97oEQJDTilSkQFeHdepfCDbfxO8/edit?usp=sharing

Comment in the file or add suggestions. Thanks a lot!

Gant Laborde
@GantMan
Jan 15 2018 14:54
I had a friend of mine asked for a function that returns true if a single false is found in an array. Here's my solution, feedback welcome:
https://goo.gl/CBxH8j
Francisco
@franciscotln
Jan 15 2018 15:51
If I understood well, from the description he gave in the link this should be any
any(equals(false))([true, true, false])  // => true
any(equals(false))([true, true, true])  // => false
any(equals(false))([true, false, false])  // => true
any(equals(false))([false, false, false])  // => true
any(equals(false))([])  // => false
@GantMan
Gant Laborde
@GantMan
Jan 15 2018 16:49
GAH!
Francisco, you're right. I'm always learning new functions that are better than what I make, hahahaha
Thanks for the best solution!
functionalStoic
@functionalStoic
Jan 15 2018 16:50
@franciscotln Nice solve. I can’t get over how much like a perfect sentence you can get with Ramda/FP
Gant Laborde
@GantMan
Jan 15 2018 17:30
by the way I like solving beginner JS exercises with Ramda. Would sharing my solution/asking for help be available here? http://exercism.io/submissions/0381e804796c43a294acc47c9840dda0
Francisco
@franciscotln
Jan 15 2018 18:37
When I have some time I can take a look, just ping me also :-)
@GantMan BTW, speaking of when, there is a R.when which is equivalent to what you've written:
    const specialCase = R.ifElse(
      divByC,
      divByCD,
      R.identity
    );

const specialCase2 = R.when(divByC, divByCD);
you don't need the placeholder in this case const isZero = R.equals(R.__, 0), just const isZero = R.equals(0);
I'm referring to your file, off course :D
Alec
@alavkx
Jan 15 2018 19:30

@isidorosp if you want a pointfree function then:

const parseData = R.pipe(
  R.transpose,
  R.converge(R.map, [ R.pipe(R.head, R.zipObj), R.tail ]),
);

Ah nice one...the solution I was trying to come up with ha. Have never thought to use map as a converging function, clever.

Gant Laborde
@GantMan
Jan 15 2018 23:40
@franciscotln - I updated that exercise with your feedback, which is awesome because now I have a record of how to do it better
Open for feedback, here's another solution: http://exercism.io/submissions/a10a6f351ef84d2ca21cf140abe79440