These are chat archives for ramda/ramda

4th
Aug 2016
zeecher Game
@zeecher
Aug 04 2016 06:03
Hi all, how to reduce usage of R.map's
  R.compose(

            R.map(template => R.assoc('template',  R.isEmpty(R.prop('front_template', template)) ?  R.prop('back_template', template)  :  R.prop('front_template', template), R.omit(['front_template', 'back_template'], template))),
            R.map(title => R.assoc('title',  R.isEmpty(R.prop('front_title', title)) ?  R.prop('back_title', title)  :  R.prop('front_title', title), R.omit(['front_title', 'back_title'], title))),
            R.uniq,
            R.map(x => R.pick(['match_id', 'front_title', 'back_title', 'front_template', 'back_template'], x))

        )(matchLines);
Scott Christopher
@scott-christopher
Aug 04 2016 06:55
@zeecher
compose(map(f), map(g)) = map(compose(f, g))
zeecher Game
@zeecher
Aug 04 2016 06:59
@scott-christopher, thank you, gonna try it...
zeecher Game
@zeecher
Aug 04 2016 08:59
This message was deleted
This message was deleted
James Grayling
@jamesgrayling
Aug 04 2016 12:43

@zeecher

map(x => pick(['match_id']), x)

is the same as

map(pick(['match_id']))
because it's curried
Ryan Zeigler
@rzeigler
Aug 04 2016 13:39
@Bradcomp i realized its actually one thats a concat and one thats a sum, so, customer merge method likely makes sense.
Brad Compton (he/him)
@Bradcomp
Aug 04 2016 14:03
@arzig take a look at mergeWithKey, might help?
Ryan Zeigler
@rzeigler
Aug 04 2016 15:18
probably, and I can do fun things like a cond to build my switch I suppose
Brad Compton (he/him)
@Bradcomp
Aug 04 2016 22:06
R.chain
Scott Christopher
@scott-christopher
Aug 04 2016 23:38
ramda/ramda#1850
Brad Compton (he/him)
@Bradcomp
Aug 04 2016 23:40
:clap: