These are chat archives for ramda/ramda

21st
Jun 2016
Vitalii Akimov
@awto
Jun 21 2016 17:20
I'm now experimenting with simpler transducers and found R.map doesn't work for arbitrary iterator, is this intentional or it may be a feature request?
the same is for R.filter and I think many other List functions
console.log(R.filter(R.gt(3),[1,2,3,4]))
console.log(Array.from(R.filter(R.gt(3),g())))

function* g() {
  yield 1
  yield 2
  yield 3
  yield 4
}
I expect first and second lines to return the same
Gabe Johnson
@gabejohnson
Jun 21 2016 17:23
@awto should you be calling g first to get the iterator?
console.log(Array.from(R.filter(R.gt(3),g())))
Vitalii Akimov
@awto
Jun 21 2016 17:25
@gabejohnson sorry, yes, copy-paste error, but it still doesn't work
LeonineKing1199
@LeonineKing1199
Jun 21 2016 17:26
In that case, transduce would have to call .next() which it probably just isn't doing.
It's interesting that you bring that up considering that Array actually supports the iterator syntax now.
Even though JS's version is iterators is horrendous and an insult to the glory of C++'s iterators.
Vitalii Akimov
@awto
Jun 21 2016 17:26
@LeonineKing1199 I'm not using Ramda transducers, I try another, transforming producers rather consumers
LeonineKing1199
@LeonineKing1199
Jun 21 2016 17:27
Ha, sorry, I assumed.
Vitalii Akimov
@awto
Jun 21 2016 17:27
I think supporting iterator in such function would unlock pretty nice feature
LeonineKing1199
@LeonineKing1199
Jun 21 2016 17:28
That's an interesting approach.
Cool find.
I could definitely see the utility of supporting the transduction of a generator
LeonineKing1199
@LeonineKing1199
Jun 21 2016 17:45
If you combined that with co, there wouldn't be anything you couldn't do. The power! It puts He-Man to shame.
Emilio Srougo
@Emilios1995
Jun 21 2016 20:35
Is there a way of using sortBy to sort by a prop, but in reverse order? Do I have to use compose(reverse, sortBy)
LeonineKing1199
@LeonineKing1199
Jun 21 2016 20:47
Can't you just rewrite your sorting function?
The signature seems to be (a -> b) where b is what's used to determine the order
LeonineKing1199
@LeonineKing1199
Jun 21 2016 21:05
My b, not the sorting function. Instead, the function that returns the order-able.
Wellington Mendoza
@well1791
Jun 21 2016 22:57
hi there!!
Scott Christopher
@scott-christopher
Jun 21 2016 23:24
:wave: