These are chat archives for ramda/ramda

20th
Oct 2016
Tobias Pflug
@gilligan
Oct 20 2016 17:52
evening
kid-icarus
@kid-icarus
Oct 20 2016 18:36
does anyone know if there is a quick way of running and() as a variadic? looks like it's a binary function
seems like allPass is a workaround, but it would be nice to use and(true, true, false, true)
Brad Compton (he/him)
@Bradcomp
Oct 20 2016 18:42
R.and
Brad Compton (he/him)
@Bradcomp
Oct 20 2016 18:42
R.all
Brad Compton (he/him)
@Bradcomp
Oct 20 2016 18:43
@ram-bot
reduce(and, true, [true, true, false, true])
ram-bot
@ram-bot
Oct 20 2016 18:43
false
Brad Compton (he/him)
@Bradcomp
Oct 20 2016 18:44
@ram-bot
all(identity, [true, true, false, true])
ram-bot
@ram-bot
Oct 20 2016 18:44
false
Brad Compton (he/him)
@Bradcomp
Oct 20 2016 18:45
If you want it to be variadic you can use:
unapply
R.unapply
kid-icarus
@kid-icarus
Oct 20 2016 18:45
ah, those all make sense
i wonder if it makes to make R.and variadic by default?
Brad Compton (he/him)
@Bradcomp
Oct 20 2016 18:46
@ram-bot
unapply(reduce(and, true))(true, true, false, true)
ram-bot
@ram-bot
Oct 20 2016 18:46
false
kid-icarus
@kid-icarus
Oct 20 2016 18:46
i'd gladly open a PR if it was something others would want
thanks for the suggestions @Bradcomp :)
Brad Compton (he/him)
@Bradcomp
Oct 20 2016 18:47
The main problem is it makes it tougher for currying
kid-icarus
@kid-icarus
Oct 20 2016 18:47
i see
Denis Stoyanov
@xgrommx
Oct 20 2016 19:04
reduce more appropriate version
in haskell => getAll $ foldMap All [True, False] via Monoid
Travis LaDuke
@laduke
Oct 20 2016 22:24
I'm missing some piece in working with Futures
    const futureAll = adapter.findAll2();
    const words = R.prop('words');

    const p = R.map(words, futureAll);

    futureAll.fork(
      err => {console.error('err', err);},
      data => {console.log(data);}
    );
^logs an array of objects with 'words' properties.
So I thought I could do something like p.fork instead
Brad Compton (he/him)
@Bradcomp
Oct 20 2016 22:27
What is the type signature of futureAll?
Oh, it's a future
dur
Travis LaDuke
@laduke
Oct 20 2016 22:28
Future e a ?
Brad Compton (he/him)
@Bradcomp
Oct 20 2016 22:30
const p = R.map(words, futureAll);  // This will map one level deep, and get the prop from your array
const p = R.map(R.map(words), futureAll); will get the prop from each element of the array
Or you could use pluck instead of map
const futureAll = adapter.findAll2();
const words = R.pluck('words');

const p = R.map(words, futureAll);
@ram-bot
const arr = [{words: 'stuff'},{words: 'things'}]

const maybeAll = S.Maybe.of(arr);

R.map(R.pluck('words'), maybeAll)
ram-bot
@ram-bot
Oct 20 2016 22:33
Just(["stuff", "things"])
Travis LaDuke
@laduke
Oct 20 2016 23:13
That makes sense
I accidentally a functor