These are chat archives for ramda/ramda

27th
May 2015
Simon Friis Vindum
@paldepind
May 27 2015 05:37
@raine See ramda/ramda#1088
Raine Virta
@raine
May 27 2015 06:09
paldepind: var o2 = R.set({a: {b: 4, c: 5}}, 0); that 0 should prolly be o
Arve Knudsen
@aknuds1
May 27 2015 06:26
Is there a version of isEmpty that returns true for undefined?
Raine Virta
@raine
May 27 2015 06:34
var _isEmpty = R.ifElse(R.isNil, R.T, R.isEmpty);
however isNil is true for nulls also, i picked it because it exists in ramda
Simon Friis Vindum
@paldepind
May 27 2015 06:57
@raine Yes. It should :)
Tobias Pflug
@gilligan
May 27 2015 09:38
guys, I have to say I have never found JS as acceptable as now that I started using ramda for everything. So a big yay to all contributors ;-)
Scott Sauyet
@CrossEye
May 27 2015 11:17
Thanks gilligan
Michael Hurley
@buzzdecafe
May 27 2015 12:41
@gilligan am I right to take it that js is still unacceptable, but at least this is closer to acceptable? :smile:
Raine Virta
@raine
May 27 2015 12:50
ramda and livescript have made (web) programming more fun than ever. but i'm still working toward type safe languages
Tobias Pflug
@gilligan
May 27 2015 13:35
@buzzdecafe it makes it a whole lot more bearable :) The fact that langs without type system suck still stands of course hehe
asaf-romano @asaf-romano wonders if compose(reverse, sort) was ever there and if there's any rule of a thumb about the inclusion of such sugar.
Asaf
@asaf-romano
May 27 2015 13:36
gosh, never going to use /me again. too much styling.
Tobias Pflug
@gilligan
May 27 2015 13:36
haha
that is very much in your face ;)
.oO(Now if only anyone had listened to puffnfresh and promises a+ wasn't the way it is.. )
Scott Sauyet
@CrossEye
May 27 2015 14:08
@asaf-romano: no hard rule. We include such when it seems generally useful. pipe and compose come to mind. At least one of them should be seen as sugar.
Asaf
@asaf-romano
May 27 2015 14:08
btw, my example was actually curry(compose(reverse, sortBy))
yes, they came to mind to, but I did see some old tickets about removing this kind of sugar
in favor of by-the-client composing.
@CrossEye btw, regarding countsBy-Map, what does it mean to have it disabled in non-ES6 environments? R.thatNewMethod == undefined? r.thatNewMethod throwing?
it's different than the general "integrate with Map" issues, because here you introduce a new function that cannot be implemented for old environments
Scott Sauyet
@CrossEye
May 27 2015 14:11
Not in favour of it in the abstract. Lots of specific cases, yes. But a library as a while can be seen as simple syntactic sugar atop the base language. My questions are about how clear it is, how generally useful, how easy to do without, etc.
Can it not be implemented, or will it simply be less efficient, a la uniq?
Asaf
@asaf-romano
May 27 2015 14:19
there's no eqv. to Map in pre-ES6 world, unless a Polyfill is provided
(I am asking about this because I'm going to try to PR them sometime soon)
uniq and count[By], that is.
Scott Sauyet
@CrossEye
May 27 2015 15:27
We have a working uniq. One that delegates to Map when it's available would be faster in that case, but would still work where it's not available. I didn't know if your count could also work this way.
Raine Virta
@raine
May 27 2015 15:54
does ramda have a function like defaultTo but one that instead takes a function instead of a value as the first argument?
Raine Virta
@raine
May 27 2015 16:03
actually no. what i want is sometimes called maybe, allong.es has it
Scott Sauyet
@CrossEye
May 27 2015 17:07

@raine: If I remember correctly, that function is something like:

maybe:: (a -> b) -> a -> b
maybe fn null = null
maybe fn a  = fn a

Sort of a poor-man's Maybe functor. Ramda doesn't include one. But of course ramda-fantasy does have a Maybe implemementation.

Santi Albo
@santialbo
May 27 2015 17:11
is there any function that does the following?
[1, 2, 3, 4, 5] --> [[1, 2], [2, 3], [3, 4], [4, 5]]
Raine Virta
@raine
May 27 2015 17:12
CrossEye: yeah, that's overkill for this though
Santi Albo
@santialbo
May 27 2015 17:17
nice!
thanks @raine
Jethro Larson
@jethrolarson
May 27 2015 22:02
@santialbo what's your usecase? I'm curious what aperture is good for.
Raine Virta
@raine
May 27 2015 22:12
http://www.preludels.com/ prelude.ls's docs are really pleasant to eye
Raine Virta
@raine
May 27 2015 22:32
wrote tmpl-cli for ramda-json-docs README :smile:
Jethro Larson
@jethrolarson
May 27 2015 22:32
One problem with using → instead of -> in the docs is that it's harder to search for the arrow. You could ctrl - f "returns array" but that content is hidden by default. Easiest way to search that right now seems to be to search the uncompressed source. :\
if you're not on mac or have alfred, you could find the terminal version useful, gist
Jethro Larson
@jethrolarson
May 27 2015 22:35
don't have the powerpack :|
Raine Virta
@raine
May 27 2015 22:36
ah too bad, it's awesome though
Jethro Larson
@jethrolarson
May 27 2015 22:36
Don't know if I can't live without it since I've been living without it
Raine Virta
@raine
May 27 2015 22:38
for me it's worth it for the clipboard history alone
i would've spent days going back and forth windows copying stuff without it
Jethro Larson
@jethrolarson
May 27 2015 22:59
I used to use e-text-editor back in the day and that had branching undo history. Was super useful but I've gone 4 years without it.
Raine Virta
@raine
May 27 2015 23:14
node_modules/ramda/dist/ramda.js:5220
            return target[method].apply(target, args);
                                 ^
TypeError: Cannot read property 'apply' of undefined
would it be completely infeasible to get some kind of human readable type error from Ramda instead of that?
David Chambers
@davidchambers
May 27 2015 23:29
Sounds good to me. Could you open an issue?