C# Needs Seqs(www.kodefuguru.com)

submitted by KodefuGuruKodefuGuru(2818) 3 months, 18 days ago

A proposition for a new keyword in C# to support IEnumberable<T>.

3 comments |category: |Views: 376

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by dpetersondpeterson(4397) 3 months, 17 days ago 0

So rather than writing IEnumerable(t) we write seq(t), or is seq(t) in addition to IEnumerable(t)?
Sequence implies that there's an order, but being IEnumerable(t) means that there isn't a particular order unless we specify how it's sorted (being that the types are generic).
A set, however, doesn't imply order, so maybe it could be set(t)?

Reply

posted by KodefuGuruKodefuGuru(2818) 3 months, 17 days ago 0

I propose seq as an alias keyword, like string is an alias for System.String.

I'm going to write an article on sequences versus sets, because I was thrown when someone else brought it up. In a sequence, order matters. This means a sequence is unique if an element differs from the comparison sequence at any position. In a set, order doesn't matter. A lottery ticket is a set. The konami code is a sequence.

Here's another way to look at it
a = 1, 2, 3
b = 3, 2, 1

If a and b are sets, they are identical. If a and b are sequences, they are different. So, the difference between a set and a sequence is that order matters for the latter. But there's more! Sets must contain unique values. {1, 1, 2, 3} is the same as {1, 2, 3}, because 1 is merely repeated in the former's definition.

I think it's pretty clear that we're referring to a sequence with IEnumerable<T>. Using that term would maintain consistency with other languages as well.

Reply

posted by dpetersondpeterson(4397) replied to KodefuGuruKodefuGuru(2818), 3 months, 17 days ago 0

Thanks for following up, that makes sense. I didn't think about the issue of uniqueness with sets.

Reply

information Login or create an account to comment on this story