These are chat archives for ramda/ramda

20th
Feb 2015
Matthew Phillips
@matthewp
Feb 20 2015 15:00
Hey everyone, there's seem to be quite a lot of functions that don't obey the automatic currying principle.
identity for example
Rocky Madden
@rockymadden
Feb 20 2015 16:46
Getting back into JavaScript from Scala/Haskell and I just wanted to say thanks for creating this library. It makes JS development more palletable. :)
Matthew Phillips
@matthewp
Feb 20 2015 16:53
Any thought to making Ramda modular like lodash recently became?
For client-side apps I don't want to have the make the choice of "all of Ramda or nothing"
David Chambers
@davidchambers
Feb 20 2015 17:54
Thanks, @rockymadden! It's good to bring a little sanity to the JS world.
@matthewp, Ramda has a custom build tool, which you can use like so:
$ scripts/build -- src/{head,tail,last,init}.js >path/to/ramda-custom.js
Matthew Phillips
@matthewp
Feb 20 2015 17:56
I don't want to do that every time I use a new function though.
All you would have to do is move the code out of src/
I know this is icky but npm unfortunately doesn't give you a better way
David Chambers
@davidchambers
Feb 20 2015 17:57
What do you mean by "move the code out of src/"?
Matthew Phillips
@matthewp
Feb 20 2015 17:58
Instead of src/appendTo.js it would just be appendTo.js
then people could do
var appendTo = require('ramda/appendTo')
alternatively
you could create a separate modular build
which is what lodash does
separate npm module
David Chambers
@davidchambers
Feb 20 2015 17:59
Are you using Ramda client-side or server-side?
Matthew Phillips
@matthewp
Feb 20 2015 17:59
Both
David Chambers
@davidchambers
Feb 20 2015 18:00
I assume you're talking client-side here, though, since Ramda's size is irrelevant on the server.
Are you using something like Browserify or CommonJS Everywhere?
Matthew Phillips
@matthewp
Feb 20 2015 18:01
Yep
I personally use es6 but this works the same regardless of commonjs/amd/whatever
(this would work in requirejs, browserify, practically any modular loader)
David Chambers
@davidchambers
Feb 20 2015 18:03
My view is that breaking Ramda into standalone modules is not a good solution to this problem, since the vast majority of Ramda functions are dependent on other Ramda functions.
Matthew Phillips
@matthewp
Feb 20 2015 18:04
by standalone I assume you mean separate npm modules? This is not what I'm suggesting
require('ramda/isEmpty')
David Chambers
@davidchambers
Feb 20 2015 18:05
Ah, right. You're suggesting that you packager will resolve the dependencies.
Matthew Phillips
@matthewp
Feb 20 2015 18:05
would still all be in the 'ramda' package
yes
practically every module loader will do this fine
David Chambers
@davidchambers
Feb 20 2015 18:05
That makes sense.
You're worried that require('ramda/src/isEmpty') is not officially supported?
Matthew Phillips
@matthewp
Feb 20 2015 18:06
yeah i guess so
i could live with that though
"src" is usually meant for pre-build files, not something you load yourself
"lib" is the common convention but i don't want to bikeshed your project
David Chambers
@davidchambers
Feb 20 2015 18:08
You're point is an excellent one. Would you mind opening an issue for it? We've actually been discussing whether we should include the src directory in the npm package. This suggests we should.
Matthew Phillips
@matthewp
Feb 20 2015 18:08
sure, thanks for listening
David Chambers
@davidchambers
Feb 20 2015 18:08
You could mention the src versus lib naming convention, too.
Matthew Phillips
@matthewp
Feb 20 2015 18:09
will do
David Chambers
@davidchambers
Feb 20 2015 18:09
Nice one. It'll be good to have a more permanent forum for the discussion.
Matthew Phillips
@matthewp
Feb 20 2015 18:09
yep, i agree
ramda/ramda#829
David Chambers
@davidchambers
Feb 20 2015 18:12
Cheers.

Hey everyone, there's seem to be quite a lot of functions that don't obey the automatic currying principle.
identity for example

What do you mean by this? R.identity is a unary function, so how is automatic currying applicable?

Matthew Phillips
@matthewp
Feb 20 2015 18:14
that's true
maybe i misunderstand
yes that makes sense now
David Chambers
@davidchambers
Feb 20 2015 18:15
Okay. I was curious as to what you had expected to happen.
Matthew Phillips
@matthewp
Feb 20 2015 18:15
I expected it to return a function that always returns the value
var one = R.partial(R.identity, 1)
essentially that
David Chambers
@davidchambers
Feb 20 2015 18:16
Ah, right! I can see that.
Matthew Phillips
@matthewp
Feb 20 2015 18:16
I almost want R to always return functions and not support taking data params at all :)
but i can see what you did it this way
*why
David Chambers
@davidchambers
Feb 20 2015 18:17
Haha. In this specific case you could use R.always(1), but that's not a general solution to the problem.
Matthew Phillips
@matthewp
Feb 20 2015 18:18
yeah
using partial is fine in these cases
David Chambers
@davidchambers
Feb 20 2015 18:18
It's not very common, though, to want to partially apply all a function's arguments.
Matthew Phillips
@matthewp
Feb 20 2015 18:19
hm, i'll see if i can find another example of where i was expecting this behavior
would you consider adding a curryRight?
or maybe this is already possible...
David Chambers
@davidchambers
Feb 20 2015 18:41
If ramda/ramda#819 is accepted we'll have the ability to partially apply any argument. For example:
var _ = R.__;
var f = function(a, b, c) { return [a, b, c]; };
var g = R.curry(f);

g(1, 2, 3);  // => [1, 2, 3]
g(_, _, 3)(1)(2);  // => [1, 2, 3]
g(1, _, 3)(2);  // => [1, 2, 3]
g(_, 2, _)(_, 3)(1);  // => [1, 2, 3]
Matthew Phillips
@matthewp
Feb 20 2015 19:25
very nice!
this is a great project and I'm impressed with how responsive you are
David Chambers
@davidchambers
Feb 20 2015 19:31
I appreciate the kind words. I agree that Ramda is a valuable project. Prior to discovering it I was pretty happy with Underscore because I didn't realize it could be so much better. :)
Matthew Phillips
@matthewp
Feb 20 2015 19:33
ah, you are not the original author then?
David Chambers
@davidchambers
Feb 20 2015 19:35
Nope. @CrossEye and @buzzdecafe created it and developed it for more than a year before I discovered it.
Robin Lambertz
@roblabla
Feb 20 2015 19:43
Wowe, that PR is exactly what I needed :O
Pablo Rosales
@PabloRosales
Feb 20 2015 20:39
Hey, just wanted to say thanks for the great work in this project. I've used R in 3 projects now :)
David Chambers
@davidchambers
Feb 20 2015 21:00
It's great to know that it's being used in the wild. Ramda does aim to be practical.