porges

Tag: Cool

Fun(c) with C# 3.0

Looking through the list of predefined (or, in Microsoft’s parlance, standard) query operators defined in C# 3.0, there is one that stands out as missing: the ‘map’ function. However, with the new query expression syntax, this is trivial to define: public static IEnumerable<T> Map<F,T>(Func<F,T> func, IEnumerable<F> source) { return from it in source select func(it); [...]

Lazy Lists in C#

I had the thought—while browsing through some old code—that the code I used to implement futures in C# would be useful for doing things lazily, if you just moved the evaluation phase to when the value was actually demanded… this started me off thinking about how to implement a proper lazily-evaluated list in C#. A [...]

Computing with XSLT

Since XSLT is basically a pattern-matching functional programming language, we should be able to use it to compute. I’m going to use it to implement one of the most basic functions: Peano-style addition. First of all we have to have an idea of what the numbers look like. We want to simulate this in XSL: [...]

Firefox extension: CustomizeGoogle

The latest version of CustomizeGoogle is great. I particularly recommend the (currently ‘in beta’) “stream search results” feature. When you would normally reach the bottom of a page in Google, the extension appends the next page onto the bottom, so you’ll never have to click “next” again!