These are chat archives for ramda/ramda

1st
Jun 2015
Scott Christopher
@scott-christopher
Jun 01 2015 10:00
While messing around with an implementation of R.uniq using Set, I noticed that R.equals(0, -0) === false. Is there a good example of when you would explicitly want this behaviour?
I’m not familiar with how/why you’d end up with a -0 to begin with.
It looks like -1 * 0 === -0, but is there a reason why the sign is significant enough to differentiate when testing for equality?
Asaf
@asaf-romano
Jun 01 2015 13:38
Object.is(+0, -0) => false
I think the the docs explicitly mention that the behavior is the same as of Object.is
Victor Cottin
@Cottin
Jun 01 2015 14:15
why does not compose return curried functions by default? http://bit.ly/1M42WSY
Raine Virta
@raine
Jun 01 2015 14:19
there's an open PR about that in #737 and more discussion in #736
Shane Keulen
@SeeThruHead
Jun 01 2015 15:19
so i have an array of objects ['ab': {}, 'bc': {}, 'cd': {}]
and i just want to modify something inside ab and bc and return a new array of objects, how would you do this in a functional style?
Simon Friis Vindum
@paldepind
Jun 01 2015 15:47
@SeeThruHead You can use R.adjust to modify arrays.
And R.evolve to modify objects.
All without actually modifying them of course ;)
David Chambers
@davidchambers
Jun 01 2015 15:50
@scott-christopher: 0 and -0 are not equivalent, since 1 / 0 is Infinity and 1 / -0 is -Infinity. Therefore 0 and -0 really are different values, despite what === suggests.
For this reason they also have different R.toString representations.
Shane Keulen
@SeeThruHead
Jun 01 2015 16:30
function removeOptik(value, key, object) {
  if (R.not(R.contains(key, optikPlanProvs))) {
    return R.init(value);
  } else {
    return value;
  }
}
what's the more functional way to do this?
Scott Sauyet
@CrossEye
Jun 01 2015 16:42
Biggest problem I see with this is that 1
Michael Hurley
@buzzdecafe
Jun 01 2015 16:43
@Cottin stay tuned. I think some changes are coming to compose
Scott Sauyet
@CrossEye
Jun 01 2015 16:45
optikPlanProv is not in scope. Is it the same as obj?
Chet Harrison
@ChetHarrison
Jun 01 2015 16:46
@buzzdecafe I will try and slim down the example I had with clone. Sorry for the code dump.
Shane Keulen
@SeeThruHead
Jun 01 2015 16:46
i moved it in scope after
function removeOptik(value, key, object) {
  var optikPlanProvs = ['ab', 'bc'];
  if (R.contains(key, optikPlanProvs)) {
    return R.map(R.init)(value);
  } 
  return value;
}
var optikProvs = R.mapObjIndexed(removeOptik, regionData);
but i would like to do it only if key in is optikPlanProvs, ortherwise return R.identity
is there a cleaner more functional way to so this, maybe with ifElse?
Shane Keulen
@SeeThruHead
Jun 01 2015 17:20
how to remove nested array items?
David Chambers
@davidchambers
Jun 01 2015 17:37
@SeeThruHead, could you provide example input and output?
Scott Sauyet
@CrossEye
Jun 01 2015 17:56
@SeeThruHead: of you haven't played with it there's a REPL at http:// ramdajs.com/repl/ . It has a 'short url' button to share the results.
Jason Yu
@jasoncyu
Jun 01 2015 19:53
Why is Ramda.ap called "ap"?
Raine Virta
@raine
Jun 01 2015 20:00
i believe it comes from haskell's <*> which also has name ap
Michael Hurley
@buzzdecafe
Jun 01 2015 20:07
ap is there for fantasyland compat. It is surprisingly useful once you get a feel for it.
Michael Hurley
@buzzdecafe
Jun 01 2015 20:40
interesting gitter feature: if you follow up a comment with a comment including a substitution expression (e.g. s/foo/bar/), it applies that expression to your prior comment
Scott Sauyet
@CrossEye
Jun 01 2015 20:57
Probably originally. Ours came from the Fantasy-land spec.