Giter VIP home page Giter VIP logo

Comments (3)

louthy avatar louthy commented on May 21, 2024

The intended use is so decision logic (has value, doesn't have value) can be used in a LINQ join for example. AsEnumerable could be useful in a lazy stream situation, where it's essentially a switch enabling or disabling the stream. AsEnumerableOne is essentially a direct conversion of the Option monad into an IEnumerable monad. So it's purely a type conversion really.

I agree that both are not needed, AsEnumerable().Take(1) = AsEnumberableOne(). It's purely for convenience.

Happy to take further feedback on this.

from language-ext.

brandf avatar brandf commented on May 21, 2024

Ok, that's more or less what I thought.

Regarding further feedback, as you said AsEnumerableOne is the direct type conversion into the IEnumerable monad, so consider renaming this AsEnumerable. What you're currently calling AsEnumerable is actually a type conversion + repeating that value forever, so consider renaming this one to have the additional suffix: AsEnumerableRepeated, if not removing it entirely.

I don't do enough functional programming to have a sense for how often the lazy stream switch situation comes up, but it sounds like something I've seen done with IObservable (System.Reactive.Linq). There is already a conversion from IEnumerable to IObservable (AsObservable), and there is already a Repeat method which makes it infinite, so the convenience seems minimal vs. just composing two existing functions.

Weighing the convenience vs. how frequent this situation comes up vs. the added confusion of having two conversions into the IEnumerable monad, etc seems warranted.

from language-ext.

louthy avatar louthy commented on May 21, 2024

Thanks for the feedback @brandf - I think you're right, and have made the necessary modifications.

from language-ext.

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.