art with code


Oh. List has functional iterators.

I've been doing things like:

List<int> l = new List<int>() {1,2,3,4,5,6,7,8,9};
List<int> m = new List<int>();
foreach (int i in l) if (i >= 5) m.Add(i);
foreach (int i in m) Console.WriteLine(i);

When I could've done:

var l = new List<int>() {1,2,3,4,5,6,7,8,9};
l.FindAll(x => x >= 5).ForEach(Console.WriteLine);

Why didn't I figure this out a month ago.
Post a Comment

Blog Archive

About Me

My photo

Built art installations, web sites, graphics libraries, web browsers, mobile apps, desktop apps, media player themes, many nutty prototypes, much bad code, much bad art.

Have freelanced for Verizon, Google, Mozilla, Warner Bros, Sony Pictures, Yahoo!, Microsoft, Valve Software, TDK Electronics.

Ex-Chrome Developer Relations.