These are chat archives for ramda/ramda

8th
Dec 2015
David Chambers
@davidchambers
Dec 08 2015 00:15
I generally enter the GitHub URL. For example: https://github.com/plaid/sanctuary#fromMaybe.
Hardy Jones
@joneshf
Dec 08 2015 03:53
@scott-christopher that map == chain seems off to me.
Scott Christopher
@scott-christopher
Dec 08 2015 03:56
Ah, the difference is yield* compared to yield
Hardy Jones
@joneshf
Dec 08 2015 03:57
Oh wow
I totally missed that
sorry
Scott Christopher
@scott-christopher
Dec 08 2015 03:57
yield* is like a flat-mapish operator
It's disappointing that generator comprehensions were dropped from the ES6 drafts
Niloy Mondal
@niloy
Dec 08 2015 09:47
How can I check if a key exists in a Object, the functional counterpart of "in" operator?
Tobias Pflug
@gilligan
Dec 08 2015 09:50
R.has('foo', {foo: 1, bar:2 })
Urmas Talimaa
@urmastalimaa
Dec 08 2015 09:50
Tobias Pflug
@gilligan
Dec 08 2015 09:50
@urmastalimaa beat you to it ;)
Niloy Mondal
@niloy
Dec 08 2015 09:51
Thanks
Niloy Mondal
@niloy
Dec 08 2015 10:39
should contains be extended to work with Objects? R.contains("bar", {foo: "bar"}) should return true
Scott Sauyet
@CrossEye
Dec 08 2015 12:42
@niloy: I don't think so, at least not with the behavior of has. It's the difference between keys and values.
Hardy Jones
@joneshf
Dec 08 2015 15:43
@niloy your question is highly related to this: ramda/ramda#1429
I forget what the resolution of that was
but the important part that I take away from it is that there are two ways of looking at objects.
If we look at them in the way that they are Functors, then it makes sense that contains would work on them as well, since they should also be Foldable (since contains can be written in terms of reduce).
If we don't look at them in that way, then I'd say it makes no sense for contains to work.
Tobias Pflug
@gilligan
Dec 08 2015 16:23
@joneshf good god - i wanted to "quickly skim" the discussion. I should take some time for that ;)
Scott Sauyet
@CrossEye
Dec 08 2015 21:52
And I misread @niloy's suggestion. To extend contains to objects consistent with has seems contradictory. To do it instead on the values is more likely, but then becomes subject to the discussions @joneshf mentioned, #1429.
Tobias Pflug
@gilligan
Dec 08 2015 23:01
@CrossEye ah, actually i got it wrong in the same way w/o realizing
Scott Sauyet
@CrossEye
Dec 08 2015 23:33
@gilligan: That was the original request. But when the extension to contains was proposed, it was changed.