These are chat archives for ramda/ramda

16th
Oct 2017
David Komer
@dakom
Oct 16 2017 14:05
question on this little Repl: https://goo.gl/1dUu2h
on line 8, why can’t I just say R.anyPass(arr1.map(R.equals)) instead of R.anyPass(arr1.map(val => R.equals(val))) ?
I get t[n].apply is not a function
Kurt Milam
@kurtmilam
Oct 16 2017 14:18
@dakom because Array.prototype.map passes more than one argument to the fn.
David Komer
@dakom
Oct 16 2017 14:19
ahh thanks
Kurt Milam
@kurtmilam
Oct 16 2017 14:19
You can call it like this, though: R.anyPass(R.map(R.equals, arr1))
David Komer
@dakom
Oct 16 2017 14:19
:+1:

passes more than one value to the fn.

why in the world would a function do that? (just kidding!)

Kurt Milam
@kurtmilam
Oct 16 2017 14:20
Badly-behaved methods :)
This would also not be a problem if Ramda chose to eschew the style of currying that makes equals( x, y ) equivalent to equals( x )( y ), instead requiring one argument per invocation (i.e. the second syntax).
David Komer
@dakom
Oct 16 2017 14:23
:)
Jonathan Rajavuori
@jrajav
Oct 16 2017 14:24
@kurtmilam Some of us think that first syntax is cleaner and more natural though :)
Kurt Milam
@kurtmilam
Oct 16 2017 14:24
@jrajav I'm aware of that, but it doesn't come for free.
David Komer
@dakom
Oct 16 2017 14:24
:popcorn:
oh gitter :\
Kurt Milam
@kurtmilam
Oct 16 2017 14:24
And it can hide some of the details about what's going on under the hood.
There's also some plumbing that has to be done on each invocation to determine whether enough arguments have been passed to the function to determine whether it has been totally applied.
The way I look at it, if the function is curried, why not just call it like it is (i.e. supply one argument per invocation). The price you pay in terms of syntax is low (two parens vs one comma, not counting white space).
Kurt Milam
@kurtmilam
Oct 16 2017 14:31
There's some interesting discussion about this topic here: sanctuary-js/sanctuary#438
With regards to the future of Ramda, this comment from @CrossEye is interesting: https://github.com/sanctuary-js/sanctuary/issues/438#issuecomment-326618397
I've been thinking about what changes might go in a Ramda 2.0 if we ever get Ramda 1.0 out the door, and one of the best simplifications I can imagine is to drop all support for polyadic functions. This of course would make it more Haskell-like, and I think would gel well with this Sanctuary proposal.
Kurt Milam
@kurtmilam
Oct 16 2017 17:49
Should this be throwing an error?
tap( console.log )( undefined )
// Cannot read property '@@transducer/step' of undefined
Brad Compton (he/him)
@Bradcomp
Oct 16 2017 17:51
@ram-bot
map(console.log)(undefined)
ram-bot
@ram-bot
Oct 16 2017 17:51
Cannot read property 'map' of undefined
Brad Compton (he/him)
@Bradcomp
Oct 16 2017 17:51
I think it's an issue with any of our functions that dispatch
Which, coincidentally, means any functions that accept transducers
Not saying it's right
Just pointing to the root of it.
Kurt Milam
@kurtmilam
Oct 16 2017 17:55
I had a less contrived example where the same thing was happening a couple of days ago, but can't find it now.
So the problem is with trying to do a property lookup on undefined?
Brad Compton (he/him)
@Bradcomp
Oct 16 2017 17:58
Exactly
I think that's a valid issue, because console.log(undefined) works fine...
Kurt Milam
@kurtmilam
Oct 16 2017 18:00
Have you seen an issue for the links to source in docs not working?
I watch the issues and have seen a few docs-related issues, but don't recall whether that one's been filed since 0.25 was released.
Brad Compton (he/him)
@Bradcomp
Oct 16 2017 18:00
Oh jeez, probably.
I looked at a bunch of stuff yesterday
Kevin Wallace
@kedashoe
Oct 16 2017 18:01
hm isn't that one fixed?
what exactly are you referring to @kurtmilam ?
Brad Compton (he/him)
@Bradcomp
Oct 16 2017 18:01
ramda/ramda#2229
:point_up: That's where the tap bug would have been introduced
Kurt Milam
@kurtmilam
Oct 16 2017 18:02
@Bradcomp yeah, I also found it surprising. I will see whether I can find a less contrived example. I was expecting to be able to test for undefined but I saw the error instead.
@kedashoe apologies, I just needed to refresh the docs and the links are working now.
Should have tried that, first.
Kevin Wallace
@kedashoe
Oct 16 2017 18:02
ok cool :beers:
Kurt Milam
@kurtmilam
Oct 16 2017 18:03
I've probably had the docs open in the same tab without interruption for over a year, so they generally only get reloaded when I reboot my PC :)
Brad Compton (he/him)
@Bradcomp
Oct 16 2017 18:03
haha
Kurt Milam
@kurtmilam
Oct 16 2017 18:20
Looks like the issue is here
Should probably add a guard to make sure obj isn't undefined before checking for a property on it. I'll file an issue and work on a PR.
Brad Compton (he/him)
@Bradcomp
Oct 16 2017 18:24
Nice
Kurt Milam
@kurtmilam
Oct 16 2017 19:13
Huh. It seems that npm test doesn't run the tests in test/internal/.