Brushing up on “whiteboard coding” for internal interviews… Inspired by Hal Ableson’s streams-based solution to this old classic in the SICP lectures, here’s a pretty concise n-Queens solution: let rec Solutions n board size = seq { // board is (x,y) tuple list of queens let safe board (x,y) = // is particular…

# Tag: Demo Code

## Wolfram – A New Kind of Turing Machine

Stephen Wolfram’s book, “A New Kind of Science” is flippin’ brilliant! (or perhaps I’m just not brilliant enough to realize he’s a mad man) 1,280 pages packed with beautiful insights and Tufte-worthy visualizations. I remember discovering it while randomly browsing the MS library one day. I became so enthralled, an hour passed just standing there…

## Ants

Gram’s blog has been pretty fun to follow. Like with Project Euler, I constantly want to implement each thing he talks about (e.g. Monadic Coconuts, Towers of Hanoi). Here now is “The Wondering Ant”: open System.Drawing open System.Windows.Forms let rec ant (x, y) (dx, dy) g i = let g’ = Array2D.mapi (fun x’…

## TinyRPN Calculator

It’s fun dorking around with the HP 41CX emulator on the iPhone. It’s a near-perfect rendition. I forgot how much I loved RPN calculators. The 48GX looks even more interesting with Reverse Polish Lisp but I haven’t figured out how to use it yet. The 41CX, on the other hand, is an old friend. 🙂…

## Sweeping Mines... Functionally

Mr. GeekRaver and I were walking between buildings and, for some reason, talking about how silly it is that good ol’ Minesweeper was “glossed up” for Vista. He said he had written it for DOS in some tiny amount of C code (http://www.bradygirl.com/Work/mine.c). His explanation of little tricks to make the implementation simple (e.g. a…