These are chat archives for ramda/ramda

14th
Mar 2016
Hardy Jones
@joneshf
Mar 14 2016 02:35
@davidchambers yeah, you have to use something with chain in it at some point with your original values, Apply isn't strong enough
@ram-bot
R.chain(R.chain(R.__, S.Just('42')), S.Just(S.parseInt(10)))
ram-bot
@ram-bot
Mar 14 2016 02:35
Just(42)
Hardy Jones
@joneshf
Mar 14 2016 02:35
perhaps more clearly:
@ram-bot
R.chain(f => R.chain(f, S.Just('42')), S.Just(S.parseInt(10)))
ram-bot
@ram-bot
Mar 14 2016 02:36
Just(42)
Hardy Jones
@joneshf
Mar 14 2016 02:36
Or maybe one more step?
@ram-bot
R.chain(f => R.chain(x => f(x), S.Just('42')), S.Just(S.parseInt(10)))
ram-bot
@ram-bot
Mar 14 2016 02:37
Just(42)
Hardy Jones
@joneshf
Mar 14 2016 02:47
I wonder though if customize couldn't use a better type?
Maybe be split up a bit?
David Chambers
@davidchambers
Mar 14 2016 02:59
I'm open to suggestions. It may be possible to simplify the type to:
customize :: String -> String -> Either String String
Hardy Jones
@joneshf
Mar 14 2016 05:34
What is it supposed to do?
David Chambers
@davidchambers
Mar 14 2016 06:12

It takes a string, which is expected to be in the form '(existing)<separator>(replacement)', where <separator> occurs exactly once. If <separator> occurs more than once, or not at all, we return a Left. Otherwise, we return a function which takes a string and replaces (existing) with (replacement) within that string. If (existing) does not appear, though, we return a Left to indicate failure.

Replacement spec:

abc

===============================================================================

xyz

Input:

foo

bar

abc

123

Output:

foo

bar

xyz

123
I wish to make a few tweaks to the Sanctuary readme before generating the corresponding HTML document. I want to be sure that if the content being replaced changes at some point, the build script will fail rather than "succeed" without replacing the unwanted content.
Hardy Jones
@joneshf
Mar 14 2016 06:16
makes sense
Jakub Korzeniowski
@kujon
Mar 14 2016 15:26
Can someone please point me to a pull request where the behaviour of R.equals for functions was fixed? 0.17.1 yields true for stuff like R.equals(function () {}, function (a, b) { return a + b; }).
David Chambers
@davidchambers
Mar 14 2016 16:27
@kujon, that was inadvertently fixed in ramda/ramda#1235.
Julien Goux
@jgoux
Mar 14 2016 17:05
Hello
is there a way to combine multiple "cond" ?
I'd like to make a big "cond" function from multiple cond
LeonineKing1199
@LeonineKing1199
Mar 14 2016 17:09
It looks like R.cond takes an array but there is also R.allPass, R.anyPass
Julien Goux
@jgoux
Mar 14 2016 17:10
If I look at the "pseudo" type, my conds function are like this :
// updateForm :: Model -> Action -> Loop [ Model, Effects ]
// updateList :: Model -> Action -> Loop [ Model, Effects ]
so I'd like to compose these two function to make a big "update" function, with the same signature
LeonineKing1199
@LeonineKing1199
Mar 14 2016 17:27
You could always use R.compose if you'd like to compose something XD
Keith Alexander
@kwijibo
Mar 14 2016 19:22
@jgoux do you mean you've got cond([[f,g]]) and cond([[h,j]]) and you want cond([[f,g], [h,j]]) ?
Risto Stevcev
@Risto-Stevcev
Mar 14 2016 19:32
Does anyone know what the status is on ramda performance? I know for a while it was comparing (or using?) Lodash as a sanity check for performance
LeonineKing1199
@LeonineKing1199
Mar 14 2016 19:35
I think it must be pretty decent for what it does. I doubt, however, that functions like R.map, R.filter, etc. are faster than the native Array.prototype methods
Keith Alexander
@kwijibo
Mar 14 2016 19:37
@LeonineKing1199 actually you'd think that native methods would be faster but it's not the case https://jsperf.com/ramda-vs-lodash/2
LeonineKing1199
@LeonineKing1199
Mar 14 2016 19:38
Oh wow, native imperative is crushing it
Keith Alexander
@kwijibo
Mar 14 2016 19:39
apparently Array.prototype.map etc have to cope with lots of edge cases that libraries can choose to ignore
LeonineKing1199
@LeonineKing1199
Mar 14 2016 19:40
Man, Lodash is fast though...
John-David Dalton
@jdalton
Mar 14 2016 19:48
Engines can optimize Array.prototype.map and others.
Some have began to but there's more runway for sure.
Keith Alexander
@kwijibo
Mar 14 2016 19:49
@jdalton that's interesting, which engines?
John-David Dalton
@jdalton
Mar 14 2016 19:50
Firefox and Chrome have done a round of optimizations.
I'm sure WebKit (JavaScriptCore) has started too.
Chakra (the engine in Edge) has optimized things like Array#indexOf.
Keith Alexander
@kwijibo
Mar 14 2016 19:53
@jdalton I think you gave a talk where you recommended using libraries over native methods?
does that still hold if the performance gap is closing?
John-David Dalton
@jdalton
Mar 14 2016 19:55
Yes as when possible the libs will use the built-in under the hood
libs give you wiggle room that the built-ins don't
LeonineKing1199
@LeonineKing1199
Mar 14 2016 19:55
Huh... Is there a library like Ramda but written in Node's native C++-module stytle?
Sebastien Daniel
@SebastienDaniel
Mar 14 2016 22:23
is there any way to contribute to the Ramda docs?
I have an issue, which is for the docs, not Ramda source.
Kevin Wallace
@kedashoe
Mar 14 2016 23:46
Sebastien Daniel
@SebastienDaniel
Mar 14 2016 23:47
thx @kedashoe
Roman Pominov
@rpominov
Mar 14 2016 23:49
Is there an explanation of type signatures syntax used in docs? I want to use same syntax for a project, but struggling with describing it. Would be cool to just put a link to existing explanation.