These are chat archives for ramda/ramda

21st
Oct 2017
Adam Szaraniec
@mimol91
Oct 21 2017 13:34
Which function can I use to set element in array?
like
const data = [5,6,7];

//setIn(1, 10)(data)

//[5,10,7]
Kurt Milam
@kurtmilam
Oct 21 2017 13:38
R.update
Kurt Milam
@kurtmilam
Oct 21 2017 13:39
@ram-bot
R.update( 1, 10 )( [5,6,7] )
ram-bot
@ram-bot
Oct 21 2017 13:39
[ 5, 10, 7 ]
Adam Szaraniec
@mimol91
Oct 21 2017 13:56
Thanks!
Denis Stoyanov
@xgrommx
Oct 21 2017 13:56
Object.assign([], [1,2,3,4,5,6], {2:5}) :smile:
Adam Szaraniec
@mimol91
Oct 21 2017 13:57
I was sure that I was wrong with when fighting with adjust and Identity :)
@xgrommx WOW, didnt know that it works like that
Kurt Milam
@kurtmilam
Oct 21 2017 15:00
Looking for help to figure out why the second and third calls to reverse_ here are not returning the desired values. I get the gist of what's going wrong, but I haven't been able to spot the cause.
Sean Lindo
@seanlindo
Oct 21 2017 15:19
What strategies do you all use to write type-safe code in Ramda?
I seem to have a good bit of "safety" code, like this:
export const parsePropertyID = R.ifElse(
    R.allPass([RA.isString, R.complement(R.isEmpty)]),
    Maybe.Just,
    Maybe.Nothing
)
Kurt Milam
@kurtmilam
Oct 21 2017 15:27
@seanlindo you might find Sanctuary Def interesting.
Regarding my previous question, reverse_ seems to work as expected as long as it isn't point-free.
Sean Lindo
@seanlindo
Oct 21 2017 15:31
That is interesting. On another note, have you used Sanctuary personally?
Kurt Milam
@kurtmilam
Oct 21 2017 15:32
I have used Sanctuary some, personally.
Sanctuary Def, as well.
The owner of Sanctuary is a Ramda contributor, btw.
There's a Sanctuary Gitter channel, as well.
Sean Lindo
@seanlindo
Oct 21 2017 15:34
I've been able to pick that up through Github issues. It looks like an interesting project, but I'm just now getting a handle on Ramda and FP principles in general, so even thinking about switching induces a bit a fatigue. I do like the safety aspects, though.
Kurt Milam
@kurtmilam
Oct 21 2017 15:34
You don't have to move 100% to Sanctuary to take advantage of runtime type-checking in Sanctuary Def.
Andrzej Lichnerowicz
@unjello
Oct 21 2017 19:38
Hi y'all
This will most probably be a dumb question, but... how to compose from async to sync funtions? I've seen some commit that deprecated composeP, although docs don't say much about it, and even regardless - I am not sure i get how composeP is different from compose
Andrzej Lichnerowicz
@unjello
Oct 21 2017 19:56
Or in other words. I have R.range of IDs, and fetch objects with that ID, so map gives me array of promises that will resolve to a json
I would like to filter that objects, but have hard time going from array of promises to array of values with a compose function
Brad Compton (he/him)
@Bradcomp
Oct 21 2017 20:24
@unjello You can use Promise.all to go from an array to Promises to a Promise of an array. then you can treat that array like any other :)