These are chat archives for ramda/ramda

26th
Feb 2016
Raine Virta
@raine
Feb 26 2016 08:50
extending ramda with own functions is foolish IMO
Julien Goux
@jgoux
Feb 26 2016 09:39
Hi
Is there a function in Ramda to replace this expression :
const notifyCounter = newGifAction
        ? Effects.constant(modifyCounter, counter.actions.increment())
        : []
if newGifAction exists, I want to return the Effects stuff, otherwise an empty array
Jakub Korzeniowski
@kujon
Feb 26 2016 09:46
R.ifElse
Jakub Korzeniowski
@kujon
Feb 26 2016 09:46
could be helpful
Raine Virta
@raine
Feb 26 2016 09:49
i don't know if you would gain anything with that
Jakub Korzeniowski
@kujon
Feb 26 2016 10:03
probably not. and it would look ugly and confusing as well imho.
Raine Virta
@raine
Feb 26 2016 10:04
ternary operator is pretty nice in JS, if-else as expression
Julien Goux
@jgoux
Feb 26 2016 11:03
Ok, I keep it that way :D
Thanks for your inputs !
Vladimir Starkov
@iamstarkov
Feb 26 2016 12:03
hey, is there any perf discussions?
R.difference is 156x slower than _.difference on two 2k-length arrays
Scott Sauyet
@CrossEye
Feb 26 2016 12:10
@iamstarkov: there have been some optimizations. The trouble is that R focuses on value equality vs _, which is happy with reference equality. From our perspective, they're faster, but they hey the wrong answer.
They *get the wrong answer.
Will try to do an example when I'm in front of a computer.
Scott Sauyet
@CrossEye
Feb 26 2016 12:41
R.difference([{a: 1}, {a: 2}], [{a: 1}]); //=> [{a: 2}]
_.difference([{a: 1}, {a: 2}], [{a: 1}]); //=> [{a: 1}, {a: 2}]
We are looking at things to optimize cases for primitive types.
Jakub Korzeniowski
@kujon
Feb 26 2016 14:16
@CrossEye why does ramda treat -0 and +0 differently? is there a discussion about this somewhere? I'd like to know more
Scott Sauyet
@CrossEye
Feb 26 2016 14:19
I don
Scott Sauyet
@CrossEye
Feb 26 2016 14:25
Sorry.
I don't remember the conversations, exactly, but we were mimicing Object.is semantics. It might not have been the best idea.
Jakub Korzeniowski
@kujon
Feb 26 2016 15:06
I guess if R.equals(+0, -0) === true then you'd expect R.divide(1, +0) === R.divide(1, -0) to hold as well. Although IEEE 754 seems to disagree: https://en.wikipedia.org/wiki/Signed_zero#Comparisons. Not clue who's right.
Scott Sauyet
@CrossEye
Feb 26 2016 15:13
Well equals isn't precisely the same as the built in mathematical operator.
@ram-bot R.equals (NaN, NaN)
ram-bot
@ram-bot
Feb 26 2016 15:13
true
Scott Sauyet
@CrossEye
Feb 26 2016 15:14
@raine: kudos once again for the great tool!
Kevin Wallace
@kedashoe
Feb 26 2016 16:13
@raine "extending ramda with own functions is foolish IMO" i am curious your thoughts on this, why do you think it is foolish and what is a better alternative?
Raine Virta
@raine
Feb 26 2016 16:26
I think it would be confusing if what appears as R in code would be something else than require("ramda")