Unicode as she is broke

code 14 March 2011 | 0 Comments

Do you think your string-handling code is robust? Are there any problems with the following snippets?

Tagged in , , , ,

C# type inference and extension methods: an abuse

code 23 February 2011 | 0 Comments

Here’s a little example of statically-sized stacks in C#. They’re implemented with a linked-list as the backing store: using System;   namespace ConsoleApplication { public static class MainClass { // Example:   public static void Main(string[] args) { var stack = Stack.New<int>(); // real type Stack<Z,int>   var s1 = stack.Push(1).Push(2).Push(3); // real type Stack<S<S<S<Z>>>> [...]

Tagged in , , , ,

n-pivot quicksort

code 12 September 2009 | 1 Comment

2-pivot quicksort This posting on the Java core library mailing list proposes to replace the current quicksort with a new, 2-pivot quicksort. Ordinary quicksort in Haskell looks something like this: quicksort [] = [] quicksort (pivot:rest) = quicksort [x| x ← rest, x ≤ pivot] ++ [pivot] ++ quicksort [x| x ← rest, x > [...]

Tagged in , , , , ,

Debugging Turing: An excursion with Scheme

code 10 August 2009 | 0 Comments

So, I thought it would be a fun idea for my first ever Lisp/Scheme program to implement Alan Turing’s original a-machines from his paper, On Computable Numbers, with an Application to the Entscheidungsproblem (paper available to public). Fun? Oh, I hadn’t any idea… Preamble; choice of implementation I decided to go with the latest and [...]

Tagged in , , , , , , , , , , , ,