These are chat archives for ramda/ramda

27th
Apr 2015
Raine Virta
@raine
Apr 27 2015 09:25
do you ever use a flipped version of R.forEach if you inline the function as expression? data last reads funny in that case
Scott Sauyet
@CrossEye
Apr 27 2015 10:23
I try to use forEach as little as possible. The only real uses I know for it not better done with something else is for side-effects. But it seems necessary for DOM processing sometimes. I don't know that I've ever flipped it.
Raine Virta
@raine
Apr 27 2015 10:29
I'm using forEach because I'm explicitly mutating an object by setting a property instead of using assoc. I'm probably overestimating the performance penalty of creating new objects...
running two db queries and merging data from one to the other as a list in a property
Scott Sauyet
@CrossEye
Apr 27 2015 11:33
reduce doesn't prevent you from returning a mutated accumulator. We don't advertise this fact, but it's quite true.
Raine Virta
@raine
Apr 27 2015 13:29
when composing a filter like R.compose(R.filter, R.propEq('id')); is there a way to use it without two separate calls? i.e. not myFilter(123)(coll) but myFilter(123, coll)
Raine Virta
@raine
Apr 27 2015 13:36
well R.useWith(R.filter, R.propEq('id'), R.identity) does the trick…
Scott Sauyet
@CrossEye
Apr 27 2015 14:27
@raine: the thing about compose/pipe is that all the arguments are passed ro the first function, then only the results of the previous one to each subsequent function. That's why we have useWith/converge.
Scott Sauyet
@CrossEye
Apr 27 2015 14:35
Note that if you're always going to call with the two parameters, the R.identity is technically unnecessary, although it might always be best practice to include it.
Raine Virta
@raine
Apr 27 2015 14:46
@crosseye I see, thanks for the explanation
cotne nazarashvili
@thecotne
Apr 27 2015 18:43
what is easy way to slice til the end? simpler then R.slice(1, R.length(arr), arr)
Brandon Wilhite
@JediMindtrick
Apr 27 2015 18:50
you mean everything but the last item in an array?
that there looks like it would give the head...which would just be R.head
cotne nazarashvili
@thecotne
Apr 27 2015 18:55
from this [1,2,3] i expect to get this [2,3] because i sliced from index 1
Brandon Wilhite
@JediMindtrick
Apr 27 2015 18:57
sorry...that's not head...that's tail
my bad
R.Tail([1,2,3]); // => [2,3]
cotne nazarashvili
@thecotne
Apr 27 2015 19:01

but i want to pass index from which i need to slice for example i may need to slice from index 3 to end

what i actually want today is R.tail but in future i may want to slice from some index

Brandon Wilhite
@JediMindtrick
Apr 27 2015 19:09
dunno if there's anything built in for that, but I would think building one shouldn't be too hard
cotne nazarashvili
@thecotne
Apr 27 2015 19:09
@JediMindtrick thx i found what i was looking for it's R.drop(1, [1,2,3]) // => [2,3]
Brandon Wilhite
@JediMindtrick
Apr 27 2015 19:09
sweet
don't take my response as indicative of this room...there's a lot of really knowledgeable people that hang out here
I'm just a learner myself
cotne nazarashvili
@thecotne
Apr 27 2015 19:13
never mind