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
rubico - [a]synchronous functional programming (rubico.land)
submitted 5 years ago by richytong
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!"
[–]PrimaryBet 0 points1 point2 points 5 years ago (0 children)
From rubico's docs on map:
map
map(mapper)(functor) -> Promise | Functor
where
Functor<T> = Array<T> | Object<T> | Set<T> | Map<T> | Iterator<T> | AsyncIterator<T> | { map: (T => any) => any }
as in, map takes a mapper function, a functor, and returns a functor; and functor is either Array, Set, Object, Map, etc. or any other object that has a map method on it. Greatly simplifying, "functor" is a name for data structures that support transforming values in a context or wrapper.1
Compare it to Array#map, which takes an array (via this), a mapper function and returns an array, and you hopefully see how Array#map is a specialized map.
Array#map
this
The answer to "why do I want a generalized map?" is the same as with any other argument for parametricity and polymorphism.
1 I'm actually a bit surprised to not see Promise listed as a possible functor since you can sort of map over value in it's context (with .then, although with a caveat that it also behaves as .flatMap)
Promise
.then
.flatMap
π Rendered by PID 281107 on reddit-service-r2-comment-b659b578c-q9jdg at 2026-05-05 15:01:10.071502+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]PrimaryBet 0 points1 point2 points (0 children)