These are chat archives for ramda/ramda

10th
Dec 2016
Irakli Safareli
@safareli
Dec 10 2016 16:54
an article I wrote on how to make long chain of function compositions stack safe
Travis LaDuke
@laduke
Dec 10 2016 22:17
When you're mapping an object, and you don't want the keys anymore... do you usually do?
@ram-bot
R.map(R.keys)({
  a: {description: {foo: 'f', bar: 'b'}},
})
ram-bot
@ram-bot
Dec 10 2016 22:18
{ a: [ 'description' ] }
Travis LaDuke
@laduke
Dec 10 2016 22:18
@ram-bot
R.map(R.keys)(R.values({
  a: {description: {foo: 'f', bar: 'b'}},
}))
ram-bot
@ram-bot
Dec 10 2016 22:18
[ [ 'description' ] ]
Travis LaDuke
@laduke
Dec 10 2016 22:19
using R.keys in the example not the best choice...
@ram-bot
R.map(R.prop('description'))({
  a: {description: {foo: 'f', bar: 'b'}},
})
ram-bot
@ram-bot
Dec 10 2016 22:20
{ a: { foo: 'f', bar: 'b' } }
Matt Ross
@amsross
Dec 10 2016 22:37
what do you want as the result?
Travis LaDuke
@laduke
Dec 10 2016 22:42
At the moment, [{"bar": "b", "foo": "f"}] Calling values first does it. Just curious if I'm missing something.
Denis Stoyanov
@xgrommx
Dec 10 2016 22:47
@laduke try pluck
Travis LaDuke
@laduke
Dec 10 2016 22:47
lol
I'm tired
Rob Halff
@rhalff
Dec 10 2016 23:00
there is not something like currify right?
Rob Halff
@rhalff
Dec 10 2016 23:13
I mean this:
const myExports = {
  upper: (str) => str.toUpperCase(),
  splitter: (str) => str.split('')
}

const currify = (fns) => {
  return keys(fns).reduce((curr, key) => {
    curr[key] = curry(fns[key])

    return curr
  }, {})
}

const { splitter, upper } = currify(myExports);

compose(
  splitter,
  upper
)('test')
Many times, I have a set of functions which are ready to be composed, but then I realize they aren't curried.
Rob Halff
@rhalff
Dec 10 2016 23:27
ok, one arg makes no sense, I've oversimplified the example :smile: