Live data from Hacker News

Lodash v3.0.0

lodash.com

11–20 of 82 posts

Re: Lodash v3.0.0

#11
post #2

Already submitted: https://hn.algolia.com/?query=lodash&sort=byPopularity&prefi... Seems like no one cares. Strange.

It's easy to not care when there's no context or indication as to what Lodash might be. Too many links, not enough time. I did click -- but only because a previous comment made it seem like Lodash was something related to functional programming. If it hadn't been for that comment, I have ignored the post, because I wouldn't have had a clue WTH Lodash was. Now, sure, people who've already used or heard of Lodash are g…

There are two kinds of JS developers, those that use LoDash at least once per function and those that have never heard of it!

Re: Lodash v3.0.0

#14
post #9
post #4

Really nice to see that there's now an auto-curried, function-first version, lodash-fp! I've been really attracted by Ramda JS recently for this reason. https://www.npmjs.com/package/lodash-fp

I've been looking for some real-world examples of how currying might be useful in javascript. Haven't not used a language which supports currying for any real world project, I'm interested to know how it can help. I found a page [1] which talks about currying in javascript, then says "Are there practical uses for currying in JavaScript? Not really." Can you point me at anything which will help me see why it's useful?…

Some code that I've written using Ramda.js:

  var predicateListFunc = function(props) { return R.allPredicates(R.map(R.curry(R.eqProps), props)); }
  var compareProperties = R.unapply(predicateListFunc);

  var mergeLists = R.unionWith(compareProperties("Property1", "Property2"));
  var groupById = R.groupBy(R.prop("Property1"));
  var getGroups = R.compose(R.toPairs, groupById, mergeLists);

  var groups = getGroups(list1, list2);

With this code I can merge any two lists (list1 and list2) on any two properties (Property1 and Property2), and then group the result. I use this to synchronize client and server data.

I don't know if this answers your question, since I wrote in about an hour of learning Ramda.js, and there might be an easier way of doing it.

Here's a fiddle:

http://jsfiddle.net/Gk6uu/10/

Re: Lodash v3.0.0

#15
post #9
post #4

Really nice to see that there's now an auto-curried, function-first version, lodash-fp! I've been really attracted by Ramda JS recently for this reason. https://www.npmjs.com/package/lodash-fp

I've been looking for some real-world examples of how currying might be useful in javascript. Haven't not used a language which supports currying for any real world project, I'm interested to know how it can help. I found a page [1] which talks about currying in javascript, then says "Are there practical uses for currying in JavaScript? Not really." Can you point me at anything which will help me see why it's useful?…

"A programmer’s pipe-dream is to write code, and be able to use it repeatedly with little effort. It’s expressive because you write in a way that expresses what is needed, and it’s reuse because.. well, you’re reusing. What more could you want? Curry can help.":

http://hughfdjackson.com/javascript/why-curry-helps/

Re: Lodash v3.0.0

#16
post #9
post #4

Really nice to see that there's now an auto-curried, function-first version, lodash-fp! I've been really attracted by Ramda JS recently for this reason. https://www.npmjs.com/package/lodash-fp

I've been looking for some real-world examples of how currying might be useful in javascript. Haven't not used a language which supports currying for any real world project, I'm interested to know how it can help. I found a page [1] which talks about currying in javascript, then says "Are there practical uses for currying in JavaScript? Not really." Can you point me at anything which will help me see why it's useful?…

This slideshow [1] by one of the authors of Ramda.js goes over a JavaScript example in OO style and refactors it to functional style. Currying is used to complete the refactoring.

I've linked to the slides on currying but you'll need to back up to follow the whole example.

[1] http://scott.sauyet.com/Javascript/Talk/FunctionalProgrammin...

Re: Lodash v3.0.0

#17
post #9
post #4

Really nice to see that there's now an auto-curried, function-first version, lodash-fp! I've been really attracted by Ramda JS recently for this reason. https://www.npmjs.com/package/lodash-fp

I've been looking for some real-world examples of how currying might be useful in javascript. Haven't not used a language which supports currying for any real world project, I'm interested to know how it can help. I found a page [1] which talks about currying in javascript, then says "Are there practical uses for currying in JavaScript? Not really." Can you point me at anything which will help me see why it's useful?…

It makes the syntax a bit better for combining functions. Seems like a small thing, but with all the complaining about nested callbacks I guess it's good. See Ramda, who came up with this concept, for a deeper discussion of the benefits.

http://fr.umio.us/why-ramda/

Re: Lodash v3.0.0

#18
post #12

It is alternative to underscore.js? Or extensions for underscore.js? Not clear from the page...

It's supposed to be better, faster, and stronger (more functions) than underscore.

It's also under active maintenance from an enthusiastic dev. Do your own research, but I go with lodash.

Re: Lodash v3.0.0

#19
post #6
post #2

Already submitted: https://hn.algolia.com/?query=lodash&sort=byPopularity&prefi... Seems like no one cares. Strange.

I use Lodash but i see not point in this announcement in its current form - what changed exactly? [edit] Changelog is there https://github.com/lodash/lodash/wiki/Changelog Some decisions sound really weird, such as the fact that forEach is now lazy. It is not a standard replacement anymore, and probably break the compatibility for quite a few apps (even if I'm deeply convinced that we should all use the native functi…

Are you talking about this?

    // in 2.4.1
    _([1, 2, 3]).forEach(function(n) { console.log(n); });
    // => logs each value from left to right and returns the lodash wrapper

    // in 3.0.0
    _([1, 2, 3]).forEach(function(n) { console.log(n); });
    // => returns the lodash wrapper without logging until `value` is called
    _([1, 2, 3]).forEach(function(n) { console.log(n); }).value();
    // => logs each value from left to right and returns the array
Seems that the only apps this change will break are those who are using side effects in a chain. Which is a pretty dubious choice, IMO. Especially given that Lodash is a "functional programming library".

Re: Lodash v3.0.0

#20
post #18
post #12

It is alternative to underscore.js? Or extensions for underscore.js? Not clear from the page...

It's supposed to be better, faster, and stronger (more functions) than underscore. It's also under active maintenance from an enthusiastic dev. Do your own research, but I go with lodash.

Lazy.js claims to be even faster than both with support for lazy evaluation to boot. Not quite a drop-in replacement like lodash is, but I think it only requires a minor tweak.
Post reply on HN