These are chat archives for ramda/ramda

4th
May 2017
TJ Peden
@tjpeden
May 04 2017 03:09
I'm trying to implement something along the lines of a zipObj with paths, any ideas?
Here's what I've got, but I feel like there's a simpler way: https://goo.gl/rqrKdz (ES5)
Obviously, it would look better in ES2016, but that's now our target atm
Matthew Willhite
@miwillhite
May 04 2017 03:39
@tjpeden Could you provide an example with input/output?
TJ Peden
@tjpeden
May 04 2017 14:01
Good morning, all
James Forbes
@JAForbes
May 04 2017 14:07
Hello!
TJ Peden
@tjpeden
May 04 2017 14:07
To answer @miwillhite's question, I started adding that last night, I'll finish that this morning and repost
Vadim Nekrasov
@barbiturat
May 04 2017 14:18
Thank you all for yesterday's answers to my question.
Now I want to ask:
Can "pipeK" "composeK" metods be useful to me if I write in typescript?
Have I understood properly that these methods are just "strongly typed" versions of "pipe" and "compose"?
Gabe Johnson
@gabejohnson
May 04 2017 14:44
@barbiturat they allow you to compose functions Monad m => a -> m b
Galileo Sanchez
@galileopy
May 04 2017 14:46
@ram-bot R.is(Number, NaN)
Gabe Johnson
@gabejohnson
May 04 2017 14:46
In the same way you might do
equals(pipe(map(f1), map(f2), map(f3))(whatever),
               map(pipe(f1, f2, f3))(whatever))
Galileo Sanchez
@galileopy
May 04 2017 14:47
rambot never obeys me >:(
@ram-bot is(Number, NaN)
@ram-bot
is(Number,  NaN)
Gabe Johnson
@gabejohnson
May 04 2017 14:48
You can do
equals(pipe(chain(f1), chain(f2), chain(f3))(whatever),
               chain(pipeK(f1, f2, f3))(whatever))
Galileo Sanchez
@galileopy
May 04 2017 14:48
nope, nu luck, however that returns True is that alright?
Vadim Nekrasov
@barbiturat
May 04 2017 14:51
@gabejohnson thank you!!
Brad Compton (he/him)
@Bradcomp
May 04 2017 15:04
I think Rambot is currently ded
R.is
Gabe Johnson
@gabejohnson
May 04 2017 15:25
@barbiturat :thumbsup:
TJ Peden
@tjpeden
May 04 2017 18:25
I'm trying to implement a sort of zipObj with paths instead of just keys, a zipObjPath if you will. Here's what I have so far: https://goo.gl/vJlqSI but I'm sure there's a better way
TJ Peden
@tjpeden
May 04 2017 18:40
Any suggestions
Brad Compton (he/him)
@Bradcomp
May 04 2017 18:48
That looks pretty good to me. What do you think needs improving?
TJ Peden
@tjpeden
May 04 2017 18:51
I feel like there are some Ramda function(s) that could probably do what that anonymous function is doing
Matthew Willhite
@miwillhite
May 04 2017 19:01
Although you could figure out a way to do with without the lambda, I’m going to bet this approach is a lot easier to read.
Denis Stoyanov
@xgrommx
May 04 2017 19:04
@tjpeden reduce(useWith((a, b) => assocPath(...b, a), [identity, props([0,1])]), {})
TJ Peden
@tjpeden
May 04 2017 19:05
Unfortunately, I have to target ES5
Otherwise, that'd be a good option
Denis Stoyanov
@xgrommx
May 04 2017 19:13
@tjpeden fully PF reduce(useWith(compose(apply(assocPath), unnest, flip(pair)), [identity, props([0,1])]), {})
@tjpeden also works reduce(compose(apply(assocPath), unnest, flip(pair)) , {})
Brad Compton (he/him)
@Bradcomp
May 04 2017 19:15
:point_up: demonstrates the benefits of using a simple lambda :stuck_out_tongue:
The second one isn't bad though
Denis Stoyanov
@xgrommx
May 04 2017 19:16
yes, lambda isn't a bad :smile:
TJ Peden
@tjpeden
May 04 2017 19:32
Honestly, I felt like the lambda wasn't very descriptive, otherwise I agree. That being said, I just got the go ahead to start our Angular app instead! :-)
Brad Compton (he/him)
@Bradcomp
May 04 2017 22:29
<3
Robert Mennell
@skatcat31
May 04 2017 22:31
What does the picture mean? Or really I should ask what's it's relvance?
Denis Stoyanov
@xgrommx
May 04 2017 22:32
lambda man
Robert Mennell
@skatcat31
May 04 2017 22:33
ah
Denis Stoyanov
@xgrommx
May 04 2017 22:33
Philip Wadler who bring monad in fp
Brad Compton (he/him)
@Bradcomp
May 04 2017 22:38
Interesting the repl link goes to http://ramdajs.com/repl/?v=0.23.0 but the header says v0.22.1
Brad Compton (he/him)
@Bradcomp
May 04 2017 22:53
looks like maybe a build step got skipped or something. The actual repl is 0.23
Rick Medina
@rickmed
May 04 2017 23:18
@skatcat31 I could tell you but I would spoil you an awesome moment in that talk