These are chat archives for ramda/ramda

Jul 2017
Julian Coleman
Jul 01 2017 07:09
If I have an array of integers, and I know that there will only be one set of twin integers, how might I find out the integer?
James Forbes
Jul 01 2017 07:43

If you want to avoid iterating through the entire list (in the best case), you could use reduce with reduced.

But it's probably more intuitive to use something like countBy(identity) @juliancoleman

The reason I even mention reduce is that it let's you keep track of previously seen values while iterating
James Forbes
Jul 01 2017 07:59
var d = [4,2,3,4,1,5]

var f = 
        prop // if it exists
        , reduced // we're done
        , (n,p) => merge(p, {[n]: true}) //mark it as seen otherwise

f(d) //=> 4
if we had millions of items, and the repeating int was in the first 5 items you might actually get a benefit from doing that
This made me notice something, does anyone know why reduced doesn't work with reduceRight ?
Jul 01 2017 08:39
Does anyone use ramda with typescript?
I got the problem that pipe and compose don't want to work with the spread operator since the number of arguments will be unknown to typescript :-/
Kurt Milam
Jul 01 2017 08:48
@JAForbes bug? (reduced with reduceRight)
James Forbes
Jul 01 2017 09:29
@kurtmilam yeah I observed the same thing, not sure if its a bug, does seem surprising though
Bijoy Thomas
Jul 01 2017 14:44
@JAForbes the ramda docs for reduced state that it does not work with reduceRight
Alexis De La Torre
Jul 01 2017 20:39
is there a reason why ramda doesnt have a bimap/dimap function?