Some general talk and kinda a "promotion" of my new (and very first) LINQ extension package

Don't know if it's okay to "promote" my own package, but it's on NuGet, has LINQPad samples, and is Apache licensed, so, maybe it's okay to talk about it here?

Well, let's get the package name out first. It's called YARLE which stands for Yet Another Random Linq Extension because I can't come up with a less silly name. It's on NuGet and it contains LINQPad samples.

I coded the extension mainly just, well, realizing my dream of what I want LINQ to do. Most functions are not that powerful, for example, there's a ForEach() function that, well, it's just a fancy way of writing "for each" statement and really not very useful considering there's Select(). But other functions can be quite useful, or powerful, for example, there's a function to convert 2D arrays into jagged arrays, and there's an InfiniteList() function that, well, it basically just generates a list that goes on forever.

It's just, I really wanted these features in LINQ before, but instead of waiting for it to come out, I finally made the decision to implement them myself. At least C# is powerful enough to allow me to do these without too much effort.

But why I'm talking about it here? Besides promotion purpose (which doesn't sound that good I guess? XD), well, after coding the package, I decided that, I want to use it in LINQPad, but I don't have a pro license. Well, I'd just make some samples for LINQPad, as that's a very good thing to do, right? And I just did so. During the sample making, it turned out that there're some severe bugs in my code. So I went fixing those bugs and finally got everything working.

Therefore, turns out that, LINQPad is a good tool to debug this kind of "algorithm pack" even if I only have the free version. Didn't expected that. I guess LINQPad would become my most favourite calculator then XD

And after implementing YARLE, it becomes quite a powerful calculator for dealing with number lists. It's just, being able to just type something like this:

Yarle.InfiniteList((x1,x2)=>x1+x2,1UL,1UL).Take(60).Dump();

To get the first 60 elements of the Fibonacci list, is nothing but magical. Sure, I can do the same thing in F#, but, it's not in one single line, and I can only get individual elements rather than a list. Being able to code exactly like math formulas when describing a list is, well, making me very happy as I'm a math student, at least. Let's be honest, who doesn't want a calculator that, you just type in the math formula and the answer is out, rather than having to figure out all the programming language details?

And that's it. Don't know if I'm reinventing the wheel, but at least I got some fun doing this small project. And hopefully this post isn't too annoying XD And... (kinda want to act like a young kid here) maybe consider giving my package a try?

Comments

  • You may not be entirely reinventing the wheel but there are other projects out there that have the same goals in mind. Maybe you can gain inspiration from them or provide help to them, since they're open source.

    https://github.com/morelinq/MoreLINQ

    https://github.com/scottksmith95/LINQKit
  • Thanks for providing these projects. My project looks kinda more mathematical-oriented than these two projects, and I'd say my project is more of making things a little bit neater rather than implementing complex features (in fact, maybe among the whole package only the InfiniteList() function offers something completely new). For example, using

    Yarle.Cardinal(1,10).ForEach(something);

    rather than

    for(var i=1;i<=10;i++) something(x);

    The code really isn't that much shorter, if any at all. But personally I feel like my way being a bit clearer, and more LINQ-y. Is it really necessary? Even I would doubt it actually.

    By the way, the idea of this package comes when I find myself more willing to use something like

    new int[Length].Select(x=>DoSomething()).ToArray()

    rather than a for-statement to, for example, initialize an array. It might not be more efficient but looks neater to me.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!