map( invoker(0, 'produceNewO') )
would that work?
map((.produce-new-o!))
(o) => o.produceNewO()
cond
to determine which object and call it’s initializer. Having all of your cases in one place
hey all, curious is there something like this in ramda or ramda-sanctuary:
const dict = {
1: 'one',
2: 'two',
3: 'three'
};
const list = [2, 3, 1];
const orderBy = dict => R.map(x => dict[x]);
const orderBy2 = R.map(R.prop);
orderBy(dict)(list);
orderBy2(dict)(list);
where i'd like to remove the argument dict
and have it passed in to R.prop, which would return me the proper map
const dict = {
1: 'one',
2: 'two',
3: 'three'
};
const list = [2, 3, 1];
map(prop(__, dict), list)
[ 'two', 'three', 'one' ]
const orderBy = (dict, list) =>
map(prop(__, dict), list)
const fakeCombinator = f1 => f2 => a1 => a2 => f2(x => f1(x)(a2), a1);
const orderBy = fakeCombinator(prop)(map);
orderBy(list)(dict);
const dict = {
1: 'one',
2: 'two',
3: 'three'
};
const list = [2, 3, 1];
const orderBy = useWith(map, [ flip(prop), identity ])
orderBy(dict, list)
[ 'two', 'three', 'one' ]
> compose(map, flip(prop))(dict)(list)
[ 'two', 'three', 'one' ]