These are chat archives for ramda/ramda

21st
Sep 2018
Alex Deas
@alex-deas_gitlab
Sep 21 2018 12:54
Firefox is always slow for me to load the repl. Been that way since as long as I can remember, chrome usually runs pretty well
Joey Figaro
@joeyfigaro
Sep 21 2018 15:47
Hey guys—if I have two objects with the same key—{ email: 'a@a.com' }, { email: 'a@a.com' }—where one could have a null/empty value, how can I manage to get propOr to try on the other object?
Brad Compton (he/him)
@Bradcomp
Sep 21 2018 15:47
I'd use R.either
Joey Figaro
@joeyfigaro
Sep 21 2018 15:48
R.either(R.prop('email', objectOne), R.prop('email', objectTwo))?
hm, doesn't seem to like that. :)
initially I was thinking of merging the two objects and then just grabbing the key like normal
Brad Compton (he/him)
@Bradcomp
Sep 21 2018 15:51
Someting like that?
Joey Figaro
@joeyfigaro
Sep 21 2018 15:53
Beautiful! ...it needed placeholders—can you explain why @Bradcomp?
Brad Compton (he/him)
@Bradcomp
Sep 21 2018 15:54
You could use flip(prop) instead, but it's like that so you can pick which property to pull
I think your example would work if you swapped either for or, I can't remember if or coerces to boolean
Joey Figaro
@joeyfigaro
Sep 21 2018 15:56
You're right—or works
Thank you :)
Brad Compton (he/him)
@Bradcomp
Sep 21 2018 15:56
:+1:
Bijoy Thomas
@bijoythomas
Sep 21 2018 19:05
Hello, is there a way to make the reducer function point free? The problem i'm facing is that if I get rid of the parameters, the function gets called with (num, arr) but I want it called like (num)(arr) .. reduceRight((num, arr) => ap(flip(set), o(lensIndex, dec))(num)(arr), repeat(0, 7))([1, 5, 7])
reduceRight((num, arr) => ap(flip(set), o(lensIndex, dec))(num)(arr), repeat(0, 7))([1, 5, 7]) returns [ 1, 0, 0, 0, 5, 0, 7 ] .. just zero fills the missing numbers
Bijoy Thomas
@bijoythomas
Sep 21 2018 19:59
I just realized there is an update function :-)
reduceRight((num, arr) => ap(flip(update), dec)(num)(arr), repeat(0, 7))([1, 5, 7])
but it also needs the num and arr args supplied one at a time and not together