These are chat archives for ramda/ramda

1st
Dec 2017
pentatronix
@pentatronix
Dec 01 2017 00:36
Ok, so still new to a lot of the concepts in FP, and so I still have lots of gaps. What's a fold, and what's a traversal?
Mike Lambert
@lambert-velir
Dec 01 2017 02:28
reduce is sometimes called fold, i'm not really sure what you mean by traversal? maybe you mean applicative functors?
I would browse through this:
https://github.com/fantasyland/fantasy-land
and watch all these: https://egghead.io/courses/professor-frisby-introduces-composable-functional-javascript
pentatronix
@pentatronix
Dec 01 2017 02:33
Ah ok awesomne :)
Traversals are used in the partial lenses project, which I am still wrapping my mind around
Vesa Karvonen
@polytypic
Dec 01 2017 07:34

@pentatronix Just a friendly reminder that questions on optics are more than welcome on the calmm gitter channel. :)

Traversals are a generalization of traverse. Of course, this tells very little. Examples, like this, of using traversals are far more helpful in getting an intuition about what traversals are and what one can do with them.

HanumanthaRaoch
@HanumanthaRaoch
Dec 01 2017 11:42
Hi all
i'm new to this RamdaJs any one can suggest me to good videos or any othe docs to learn Ramada
Bernat Jufré Martínez
@bjufre
Dec 01 2017 11:58
@HanumanthaRaoch not a bad resource: Egghead Ramda, the con is that is pro version
This is a good one Thinking in Ramda, from 2016 though
HanumanthaRaoch
@HanumanthaRaoch
Dec 01 2017 12:04
@behind-design thanq
Mike Lambert
@lambert-velir
Dec 01 2017 16:37
what's the deal with R.contains and Array.prototype.includes?
R.contains does a deep equals, but otherwise, seems the same. Should they have the same name?
Brad Compton (he/him)
@Bradcomp
Dec 01 2017 16:57
I don't think it's necessary to use the same name. One big difference is that contains is a function, whereas includes is a method. If you do use includes as a function (via call or apply) then the parameter order is switched from what is in Ramda. So there are a few differences.
Mike Lambert
@lambert-velir
Dec 01 2017 18:05
well, that difference exists for most of ramda functions, R.indexOf Array.prototype.indexOf
Brad Compton (he/him)
@Bradcomp
Dec 01 2017 18:23
This is true, but there is no consistency when it comes to that stuff. See all vs every, any vs some
Mike Lambert
@lambert-velir
Dec 01 2017 19:48
hmm, yeah
Julian Coleman
@juliancoleman
Dec 01 2017 20:05
How would I go about splitting an array at each capital letter, while keeping the words intact? It looks like R.split(/[A-Z]/g) will actually remove all caps, but will split into an array
Mike Lambert
@lambert-velir
Dec 01 2017 20:06
I think you can use a non-capturing group
something like (?=[A-Z])
R.split(/(?=[A-Z])/g
Julian Coleman
@juliancoleman
Dec 01 2017 20:08
whoa.... I did not know that had anything to do with it
non-capturing group solved it
Mike Lambert
@lambert-velir
Dec 01 2017 20:09
yeah, regex is crazy
i think what it's saying is match nothing if it's followed by a capital letter
x(?=y)
Matches x only if x is followed by y.
Julian Coleman
@juliancoleman
Dec 01 2017 20:14
that makes sense
Why does this here still work then? Any explanation? I just don't know enough about Regexes
I'm working on a string library and I've had to learn quite a bit about it just to get this all working. I used to use underscore.string, but I am making something functional that will work with Ramda. Essentially, the functions waterfall through one another in a functional manner. Would this cause an unexpected result in the waterfall?
Mike Lambert
@lambert-velir
Dec 01 2017 20:20
a non-capturing group is actually (?:, that's my mistake
(?=[A-Z]) is working because it's saying split on nothing if it's followed by a capital letter
if you did R.split(/./g), you would get a bunch of empty strings,
but you could do R.split(/(?=(?=.)/g), and you'll get back an array of each letter
Vasili Sviridov
@vsviridov
Dec 01 2017 20:22
check out regex101.com, it has a nice explanation system that breaks down everything your regex is doing
and a regex debugger, where you can see execution and backtracking step-by-step
Julian Coleman
@juliancoleman
Dec 01 2017 20:22
I only ever use regex101
Mike Lambert
@lambert-velir
Dec 01 2017 20:23
oh nice, i didn't know about that site, thanks! :thumbsup:
Julian Coleman
@juliancoleman
Dec 01 2017 20:23
@lambert-velir that is the trippiest thing I've ever seen, and I'm pretty familiar with Brainfuck. That's saying something
Mike Lambert
@lambert-velir
Dec 01 2017 20:23
so (?= is a Positive Lookahead
Barry G
@bgits
Dec 01 2017 22:50
Does omit mutate the original object?
pentatronix
@pentatronix
Dec 01 2017 22:57
@bgits No, all Ramda objects return a new object with any changes made to the new object