These are chat archives for ramda/ramda

11th
Mar 2017
Galileo Sanchez
@galileopy
Mar 11 2017 00:17 UTC
from irc { head: message.slice(0, 5), data: message.slice(5, 40).toUpperCase(), unparsedMessage: message } I was overthinking it apparently
Michael Rosata
@mrosata
Mar 11 2017 05:24 UTC
@galileopy Whichever parts you think would be likely to change are the ones you'd be best to make "flexible". You might want something easier to read than your original but easier to configure and reuse than the last line. Something like this but better:
const setData = curry(
  (path, transform, getter, data) => assocPath(path,  transform(getter(prop('unparsedMessage', data))), data)
);

const finalValue = compose(
  setData(['head'], toUpper, slice(0, 5)),
  setData(['data'], slice(10, 25), identity)
)(message)
Even what I just wrote isn't super easy to read. but I'm sure if you moved some things around, renamed my horrible variable names you'd do well
Keith Alexander
@kwijibo
Mar 11 2017 17:39 UTC
Just found an awesome package on npm https://www.npmjs.com/package/effectuate
lets you pipe stdin through an exported function to stdout
$ echo 4 | effectuate-piped ramda/src/add 3
7
Raine Virta
@raine
Mar 11 2017 20:24 UTC
@kwijibo
$ echo 4 | R 'add 3'
7
Keith Alexander
@kwijibo
Mar 11 2017 21:30 UTC
@raine your ramda-cli ? (that's awesome too)
Rob Hilgefort
@rjhilgefort
Mar 11 2017 22:29 UTC
Is there a “wait to execute” method? For instance, I want to execute a curried method in a then block without having to wrap it in pipe or something.
.then(foo(arg1, arg2, arg3));
👆, but I don’t want to execute foo until the then is hit
Raine Virta
@raine
Mar 11 2017 23:51 UTC
@rjhilgefort do you have a more complete example of what you want to achieve