These are chat archives for ramda/ramda

31st
Dec 2015
Scott Christopher
@scott-christopher
Dec 31 2015 00:01
It'd be interesting to see how lenses could be used to create a date/time lib like moment.js
boxofrox
@boxofrox
Dec 31 2015 02:55
@scott-christopher I was just thinking how much I'd prefer moment.js to be more immutable the other night. :laughing:
what were your thoughts on using lenses. store the date as {year, month, day, etc}, and use lenses to peak and change values, or would those work off a single numeric value and do the conversions like @joneshf was demoing earlier?
Scott Christopher
@scott-christopher
Dec 31 2015 05:36
My thoughts were around performing the calculations by translating to some canonical form (like UTC time), but presenting the view in some lens-like translation of the result.
Stefano Vozza
@svozza
Dec 31 2015 08:09
@boxofrox a friend of mine has created an autocurried and immutable date/time lib (no timezone functions though though) https://github.com/cullophid/date-fp
Asaf
@asaf-romano
Dec 31 2015 19:04
@CrossEye yt?
Scott Sauyet
@CrossEye
Dec 31 2015 19:08
am now
Asaf
@asaf-romano
Dec 31 2015 19:11
@CrossEye before I'm jumping into that PR. Is there any reason not to curry the resulting function of juxt?
I saw the discussion at the original issue but couldn't figure out why it wasn't done after all
converge does that, so my suggested implementation would do so as well
Scott Sauyet
@CrossEye
Dec 31 2015 19:12
No, I can see no reason not to call curryN with the max of the function arities.
Asaf
@asaf-romano
Dec 31 2015 19:13
I don't need to call curryN at all
Scott Sauyet
@CrossEye
Dec 31 2015 19:13
what would you call?
Asaf
@asaf-romano
Dec 31 2015 19:13
It's just converge with the first argument being polyfilled Array.of
and converge curries.
Scott Sauyet
@CrossEye
Dec 31 2015 19:15
ok, but we are fairly wary of layering our functions. We do it when it doesn't seem to offer any serious performance problems, but usually go back to first principles in most places. We'd rather not have users blow too much of their performance budget on library code.
But I would try it your way unless we see a performance problem.
Asaf
@asaf-romano
Dec 31 2015 19:16
yeah, i know, but here I don't think there's such harm. juxt is really just sugar (great sugar though!) above converge.
Scott Sauyet
@CrossEye
Dec 31 2015 19:17
funny, though, that until you mentioned it, I never really thought about it that way. Now it seems obvious.
Asaf
@asaf-romano
Dec 31 2015 19:17
Only problem is that my polyfilled Array.of implementation should go somewhere in internal/, but I don't have a good name for ir
it
since of is already reserved
Scott Sauyet
@CrossEye
Dec 31 2015 19:18
toArray or makeArray or some such. Since it's internal, the name doesn't have to be beautiful.
Asaf
@asaf-romano
Dec 31 2015 19:19
makeArray sounds dirty enough to be variadic. thanks :)
Raine Virta
@raine
Dec 31 2015 19:20
list arrayOf
Asaf
@asaf-romano
Dec 31 2015 19:22
arrayOf it is
Scott Sauyet
@CrossEye
Dec 31 2015 19:23
sounds fine
Asaf
@asaf-romano
Dec 31 2015 19:39
Sigh, juxt supports 0 arguments :-/
Scott Sauyet
@CrossEye
Dec 31 2015 19:40
no reason for it to. No one could really be counting on that.
Asaf
@asaf-romano
Dec 31 2015 19:40
there's a test
"juxt works with no functions and no values:"
and also
"juxt works with no functions and some values:"
both of which fail with plain converge implementation
I could keep that working by special-casing length == 0
or fixing converge to allow that
Scott Sauyet
@CrossEye
Dec 31 2015 19:42
I understand. This is a brand-new function, and it's tests were as likely built against its implementation as for anything else.
It would be a breaking change, but I don't think it would be a big deal for any likely use-case to insist that there have to be actual functions supplied.
you might want to ping the original author of it to make sure he doesn't have an actual rationale for that.
Asaf
@asaf-romano
Dec 31 2015 19:43
will do
I think it's actually nice that it supports that, but I, of course, cannot really imagine a use case for that
so I don't mind either way
don't want to hurt 600 students though :)
Scott Sauyet
@CrossEye
Dec 31 2015 19:45
I have no issue with looking into converge, but I just can't see the point in that.
no, absolutely not.
love having that use of Ramda out there!
Asaf
@asaf-romano
Dec 31 2015 19:47
I wonder if there's some way to automated a retains-arity test. This bugs are so nasty and hard to catch :-/
Asaf
@asaf-romano
Dec 31 2015 19:53
commented there. hopefully he's around.
Hardy Jones
@joneshf
Dec 31 2015 22:25
@lucasfeliciano @gilligan Finally finished that post: http://joneshf.github.io/programming/2015/12/31/Comonads-Monoids-and-Trees.html
Asaf
@asaf-romano
Dec 31 2015 22:52
@CrossEye I went ahead and fixed converge because the fix is minimal and the behavior makes sense to me (even though it's hardly useful)
anyway, PRed both functions