Giter VIP home page Giter VIP logo

Comments (12)

puffnfresh avatar puffnfresh commented on August 18, 2024

Thanks! It'll be interesting to see what others think about the changes. I find it much harder to read without the names of the algebras and laws (something which was asked for).

But I'm obviously biased since I wrote most of it.

from fantasy-land.

ForbesLindesay avatar ForbesLindesay commented on August 18, 2024

I think it would be worth naming the laws. I'll add those in in a second. It would be useful when writing test suites if nothing else.

I think naming the objects is nice, but I think it should be at the end of the description of the method, rather than at the top level. Consider that most of your intended audience is much more familiar with JavaScript than Category Theory. Keep in mind that .map and .concat behave exactly like they do currently on arrays, which will make them feel instantly intuitive when labelled like that. .of also behaves exactly like .of will in ES6 if it makes it I think (needs checking, and this spec will need to pick another name if that's not true).

I think empty may be better as a name than zero if it doesn't conflict with anything that already exists. An empty array makes intuitive sense for example.

I think .chain may not be the most intuitive name either. I'd consider .flatten which seems very nice for arrays, and not totally un-intuitive for promises. Unfortunately .then would be pretty un-intuitive for arrays, but I guess it's not the end of the world.

from fantasy-land.

ForbesLindesay avatar ForbesLindesay commented on August 18, 2024

I've added in comments to link back to functional programming. Hopefully this is now approachable for people from both directions.

from fantasy-land.

junosuarez avatar junosuarez commented on August 18, 2024

+1 for empty. This makes sense to me thinking in terms of data structures rather than numeric values. It's not as pure algebraically, but it's a bit more concrete.

@ForbesLindesay see #2 for a lengthy discussion about .chain

Overall, @ForbesLindesay, great work - seems very approachable.

from fantasy-land.

puffnfresh avatar puffnfresh commented on August 18, 2024

@jden I wanted to use empty but was afraid it would already be in use. Don't think so?

from fantasy-land.

ForbesLindesay avatar ForbesLindesay commented on August 18, 2024

I'm not aware of any current uses. At least not in core EcmaScript or node.js

from fantasy-land.

seidtgeist avatar seidtgeist commented on August 18, 2024

I think empty is safe. No mention of it on MDN, only _.isEmpty in lodash/underscore comes to mind.

from fantasy-land.

puffnfresh avatar puffnfresh commented on August 18, 2024

Awesome, if I have no objections by the end of today then I'll use it.

from fantasy-land.

junosuarez avatar junosuarez commented on August 18, 2024

Ping re empty ^

from fantasy-land.

TimMoore avatar TimMoore commented on August 18, 2024

+1 for empty. Using zero would be misleading in some contexts (e.g., Product)

from fantasy-land.

junosuarez avatar junosuarez commented on August 18, 2024

Reference: 2091648

from fantasy-land.

junosuarez avatar junosuarez commented on August 18, 2024

This issue is still showing up on my personal "open issues mentioning you" list, limiting its utility. Could you please consider closing it?

from fantasy-land.

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.