These are chat archives for ramda/ramda

1st
Jul 2017
Julian Coleman
@juliancoleman
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
@JAForbes
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
@JAForbes
Jul 01 2017 07:59
e.g.
var d = [4,2,3,4,1,5]

var f = 
  reduce(
    flip(
      ifElse( 
        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 ?
alpox
@alpox
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
@kurtmilam
Jul 01 2017 08:48
@JAForbes https://goo.gl/kw7ER5 bug? (reduced with reduceRight)
James Forbes
@JAForbes
Jul 01 2017 09:29
@kurtmilam yeah I observed the same thing, not sure if its a bug, does seem surprising though
Bijoy Thomas
@bijoythomas
Jul 01 2017 14:44
@JAForbes the ramda docs for reduced state that it does not work with reduceRight
Alexis De La Torre
@Alexis-De-La-Torre
Jul 01 2017 20:39
is there a reason why ramda doesnt have a bimap/dimap function?