« March 2009 | Main | June 2009 »

April 26, 2009

Possibly the most obscure humour in the world, ever

Via Brian McNamara, at last someone has combined functional programming at its most theoretical with amusing cat photos.  Let’s hear a big “/* You are not expected to understand this */” for… lambdacats!

io-monad

type-error-2 

I really need to slap a caption on that photo of Fang reviewing the WPF Property Grid code.

April 26, 2009 | Permalink | Comments (2) | TrackBack

April 19, 2009

The passive voice strikes back

Geoffrey K Pullum commemorates 50 Years of Stupid Grammar Advice: “What concerns me is that the bias against the passive is being retailed by a pair of authors so grammatically clueless that they don't know what is a passive construction and what isn't… The book’s toxic mix of purism, atavism, and personal eccentricity is… often so misguided that the authors appear not to notice their own egregious flouting of its own rules. They can't help it, because they don't know how to identify what they condemn... English grammar… is much too important to be reduced to a bunch of trivial don’t-do-this prescriptions by a pair of idiosyncratic bumblers who can't even tell when they've broken their own misbegotten rules.”  Too many good bits to quote; well worth a read.

April 19, 2009 | Permalink | Comments (0) | TrackBack

April 18, 2009

I am kindling. Hear me roar

Cat curled up in front of fireplace = scene of adorable domesticity.

Cat curled up in fireplace = need better cat.

April 18, 2009 | Permalink | Comments (0) | TrackBack

April 12, 2009

Building Clojure for the CLR

David Miller has announced a port of Clojure, the Lisp dialect for the JVM that’s getting a lot of buzz, to the .NET CLR.  Sources are up at the clojure-contrib site.

It’s pretty easy to get it building and running but if you’re using a recent version of the DLR (I was on 21259) then you’ll probably need to make a couple of minor changes:

  • ClojureCLR tries to new up ScriptCode in a few places.  ScriptCode is now an abstract class, so this causes compiler errors.  Changing ScriptCode to LegacyScriptCode seems to fix the problem.  (It probably isn’t the right solution, but it’s enough to get things up and running.)
  • If you try to use a .NET API call in the REPL, e.g. (Math/Pow 3 4), you get a runtime error of type ArgumentException complaining about a type error in the printToConsole method.  To work around this, go into Generator.cs (in the Compiler folder), find the Generate(object, bool) method, locate the if (addPrint) body, and add the line finalExpr = Expression.Convert(finalExpr, typeof(object)); at the top of the body of the if-statement.  Again, not sure if this is the right thing to do, but it gets the API calls working.

April 12, 2009 in Software | Permalink | Comments (9) | TrackBack

April 05, 2009

Things I did not know, number 8073

Plastic bowls can cause mouth acne in cats.

April 5, 2009 | Permalink | Comments (2) | TrackBack

April 03, 2009

Faster development through less crap

A couple of tips for .NET developers who get frustrated with how slow everything is.

Speeding up XAML editing

To get a much faster and more stable WPF XAML editing experience, right-click a XAML file and choose Open With > Source Code (Text) Editor > Set as Default.  This gets you the full XAML editor, with Intellisense, without bogging you down with the visual designer.  It is about a million times faster, even compared to the designer’s XAML-only view, especially when you have multiple XAML files open.  If you need an excuse to go get some coffee, do your shopping or take a three-month hiking tour of the Himalayas, you still open the visual designer using, wait for it, the View Designer command.  (Thanks to Fabrice Marguerie.)

Speeding up MSDN

To get MSDN online to come up quickly in the browser, switch to the low-bandwidth version.  You don’t get fancy resizing or buckets of graphics, but you get the content and you get it quick.  Click here to see what it’s like and choose “Persist low bandwidth view” if you like it – that way you get the fast view even when following a link to the slow version.  (Thanks to Craig Andera.)

April 3, 2009 in Software | Permalink | Comments (2) | TrackBack

April 02, 2009

Mathematics and programming

Jeff Atwood disputes the theory that competent programmers should be mathematically inclined.  His conclusion may or may not be correct – I don’t have any evidence one way or the other.  His reasoning, however, is wrong.

Jeff observes that “the vast bulk of code that I've seen consists mostly of the ‘balancing your checkbook’ sort of math, nothing remotely like what you'd find in the average college calculus textbook, even,” and gives the example i = j++ / (x + v) -- “not,” he rightly observes, “exactly the stuff mathletes are made of.”

Right, and nothing to do with being mathematically inclined either.  Jeff seems to be one of those people who believes that what mathematicians do is sit around doing ever harder calculations.  The sort of people who can only imagine Andrew Wiles proved Fermat’s Last Theorem by a fiendishly complicated process of long division.

In reality, the bulk of mathematical effort goes not into performing calculations, but into hypothesising and proving general truths.  Let’s take a quick run down of the kind of skills mathematicians really use in doing this:

  • Identifying useful abstractions – separating out the salient points of a problem.
  • Formulating a path from A to B – building a high-level plan of attack for a problem or proof.
  • Turning that plan of attack into a series of precise and rigorous steps, expressed using an abstract and formal notation.
  • Bundling up appropriate partial results into handy lemmas – another example of identifying useful abstractions.
  • Thinking about special cases that might invalidate the assumptions of the proof or require special handling.

The core skills of mathematics sound awfully like the core skills of programming.  It is only “very hard … to draw a direct line from ‘good at math’ to ‘good at programming’” if you confuse mathematics with “mathletics.”

April 2, 2009 in Science, Software | Permalink | Comments (3) | TrackBack