Re:Introducing a new data structure, streams, in Javascript
by LPCRoy on Sunday September 11, 2011 @12:58PM
(#2984155)
There is also "LINQ for Javascript", which is fully integrated in with JQuery and VS as well. http://linqjs.codeplex.com/
Streams seems to be a proper subset of the things you can do with linqjs. Sometimes MSFT can do cool things too, it just doesn't always get picked up :)
Re:Introducing a new data structure, streams, in Javascript
by buddydvd on Sunday September 11, 2011 @01:11PM
(#2984192)
Actually, we're talking about the same project. I linked to its reference page for the examples.
Re:Introducing a new data structure, streams, in Javascript
by esk on Sunday September 11, 2011 @03:14PM
(#2984524)
Thank you for mentioning this—I had no idea it existed! Do you use lazy enumerables in your projects?
I can think of a few fun uses (such using them as creative replacements for looping constructs), but I'm struggling to find a problem that is most easily solvable with these.
Re:Introducing a new data structure, streams, in Javascript
by buddydvd on Sunday September 11, 2011 @06:22PM
(#2985038)
Yes, I use them liberally in C# projects. In fact, I prefer to use them over the standard looping constructs because of the pipe-like characteristics. It's very useful.
Re:Introducing a new data structure, streams, in Javascript
by dionyziz on Monday September 12, 2011 @01:37AM
(#2985978)
buddydvd, linq looks quite nice. Thanks for mentioning it, I had no idea it existed. I added a link to it at the 'Tribute' section of stream.js in case someone wants to check it out or prefers its syntax instead :)
Re:Introducing a new data structure, streams, in Javascript
by artursapek on Sunday September 11, 2011 @03:02PM
(#2984487)
Does that require the obnoxious 100000000000, or could that be left blank?
Re:Introducing a new data structure, streams, in Javascript
by buddydvd on Sunday September 11, 2011 @06:07PM
(#2985011)
It's not required, but you'd have to write your own generator function:
Enumerable
.Generate((function() {
var i = 0;
return function() {
return i++;
};
})())
.Take(10)
.ToArray()
Output: 0,1,2,3,4,5,6,7,8,9
http://neue.cc/reference.htm
Output: