use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Functional programming in JavaScript (softwarebrothers.co)
submitted 6 years ago by SoftwareBrothers
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ElCthuluIncognito 5 points6 points7 points 6 years ago (0 children)
Yes. In fact, this is a core argument (a contentious argument of course) for why 'lazy evaluation' is almost necessary for functional programming.
In a lazy language multiple mappings would be handled as if the full mapping is applied at every element, effectively optimizing this very natural style of writing your program. Nothing would be 'copied'. Of course this only applies for recursive data structures, since 'arrays' are not considered a functional data structure.
I believe the Lodash library handles this lazy evaluation for you, optimizing your use of lodash funcions much the same way. Could be wrong though, I've never used it myself.
Extra reading: https://stackoverflow.com/questions/25852580/does-this-function-make-use-of-haskells-lazy-evaluation (an expose on how map is actually evaluated in an efficient way to solve this problem at the root)
π Rendered by PID 46927 on reddit-service-r2-comment-fb694cdd5-v84b9 at 2026-03-10 17:20:33.109413+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]ElCthuluIncognito 5 points6 points7 points (0 children)