Code Monkey home page Code Monkey logo

Comments (11)

fabricematrat avatar fabricematrat commented on August 23, 2024

chain seems to be used since the last 10 month in fantasyland. Personally, I prefer to have a common vocabulary even if I do start to like flatMap. But personal preference is not likely to be the choice of the community.
I don't know when the status on TC39 did change, or move and if this is stable.

from most.

briancavalier avatar briancavalier commented on August 23, 2024

As of #14 it's been switched to chain, but I still don't think there's a clear winner. Fantasy-land still uses chain, while similar projects, such as Bacon.js and RxJS use flatMap.

from most.

fabricematrat avatar fabricematrat commented on August 23, 2024

flatMap seems better to me

On Mon, Jul 21, 2014 at 4:45 PM, Brian Cavalier [email protected]
wrote:

As of #14 #14 it's been switched to
chain, but I still don't think there's a clear winner. Fantasy-land still
uses chain, while similar projects, such as Bacon.js and RxJS use flatMap.


Reply to this email directly or view it on GitHub
#13 (comment).

Best regards,

┏( ^◡^)┛ ┗(^◡^ )┓ I rock RaveJS! ┏( ^◡^)┛ ┗(^◡^ )┓

http://rivieragug.org/
http://3musket33rs.github.com/
http://fabricematrat.github.io/

from most.

briancavalier avatar briancavalier commented on August 23, 2024

I prefer flatMap too. Should we provide both as aliases?

from most.

fabricematrat avatar fabricematrat commented on August 23, 2024

Sure !
On Jul 21, 2014 4:53 PM, "Brian Cavalier" [email protected] wrote:

I prefer flatMap too. Should we provide both as aliases?


Reply to this email directly or view it on GitHub
#13 (comment).

from most.

unscriptable avatar unscriptable commented on August 23, 2024

👍 for alias.

from most.

briancavalier avatar briancavalier commented on August 23, 2024

I've become averse to "do both", but in this case, it's just not clear what is the right criteria for choosing:

chain

Pros

  • Used by fantasy-land
  • Nice, short name
  • Conceptually, monads provide sequencing for functional operations, hence the name "chain" makes sense: chaining computations together.

Cons:

  • Not as immediately obvious what it does to anyone not familiar with monads
  • Not used by as many other libs/languages. "oh, I see now, it's kinda like flatMap?"

flatMap

Pros
* Used by more other libs: Bacon.js, RxJS, Scala, other reactive libs in other languages
* Slightly more obvious what it does, at least in the list/sequence/stream domain. Nice contrast with .map

Cons
* Uglier to type?

Others?

Here's a thought: Designate flatMap as the primary API, and chain as the "fantasy-land compatibility" alias?

from most.

fabricematrat avatar fabricematrat commented on August 23, 2024

I would agree chain/flatMap is about composition but typing flatMap is not
ugly it relates to the map. It's also relating to the type of chaining you
want to apply. Chaining in a flatMap style. Chain seems more general but
here it's really a flatMap method like in other language. In other hands JS
Frw seems also to like chain like lodash for example but is it the same
principle ?

On Mon, Jul 21, 2014 at 5:17 PM, Brian Cavalier [email protected]
wrote:

I've become averse to "do both", but in this case, it's just not clear
what is the right criteria for choosing:
chain

Pros

  • Used by fantasy-land
  • Nice, short name
  • Conceptually, monads provide sequencing for functional operations,
    hence the name "chain" makes sense: chaining computations together.

Cons:

  • Not as immediately obvious what it does to anyone not familiar with
    monads
  • Not used by as many other libs/languages. "oh, I see now, it's kinda
    like flatMap?"

flatMap

Pros

  • Used by more other libs: Bacon.js, RxJS, Scala, other reactive libs in
    other languages
  • Slightly more obvious what it does, at least in the list/sequence/stream
    domain. Nice contrast with .map

Cons

  • Uglier to type?

Others?

Here's a thought: Designate flatMap as the primary API, and chain as the
"fantasy-land compatibility" alias?


Reply to this email directly or view it on GitHub
#13 (comment).

Best regards,

┏( ^◡^)┛ ┗(^◡^ )┓ I rock RaveJS! ┏( ^◡^)┛ ┗(^◡^ )┓

http://rivieragug.org/
http://3musket33rs.github.com/
http://fabricematrat.github.io/

from most.

briancavalier avatar briancavalier commented on August 23, 2024

In other hands JS Frw seems also to like chain like lodash for example but is it the same
principle ?

Good point, "chain" has different connotations in other libraries, like lodash as you mentioned. In lodash, _.chain is not flatMap

What do you think about the idea above to document flatMap as the primary API, and chain as the fantasy-land compatibility alias?

from most.

briancavalier avatar briancavalier commented on August 23, 2024

Ok, flatMap and chain are now aliases.

from most.

aaronshaf avatar aaronshaf commented on August 23, 2024

This doesn't seem documented yet. See pull/95

from most.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.