These are chat archives for ramda/ramda

25th
May 2015
Scott Sauyet
@CrossEye
May 25 2015 01:02
@paldepind: Thanks. Yes, that immediate response was amusing.
Scott Sauyet
@CrossEye
May 25 2015 01:10

I'm not sure what is meant by transpose here. If it's simply array transposition, this might do it:

var transpose = function(a) {
    return R.mapIndexed(function(col, i) { 
        return R.map(R.nth(i), a)
    }, R.head(a));
};

That was my original solution in #1068.

Raine Virta
@raine
May 25 2015 07:37
I'm trying to think of ways to map object's keys
  1. invertObj . mapObj . invertObj
  2. fromPairs . map(headLens.map(fn)) . toPairs
    what else?
Hardy Jones
@joneshf
May 25 2015 15:33
wont the first one break?
Raine Virta
@raine
May 25 2015 15:34
ah yeah I meant it as pseudo-ish code
Hardy Jones
@joneshf
May 25 2015 15:36
no, i mean invertObj isn't a bijection. so you can't invert it like that
R.compose(R.values, R.invertObj, R.mapObj(f), R.invertObj) !== R.values
R.invertObj({foo: 3, bar: 3}) == {3: 'bar'}
Raine Virta
@raine
May 25 2015 15:43
oh, hm