# September, 2010

Posts
• #### FScheme - Scheme in F#

[Part 1 of the FScheme series ] One of my New Year’s goals is to re-read Lisp in Small Pieces and implement all 11 interpreters and 2 compilers. As much as I like the "Lisp in Lisp" idea and enjoyed the eureka moment in SICP when Sussman writes...
• #### Microcode-level HP-35 Emulator (in JavaScript!)

[Part 1 of the HP Calc series ] I recently started a super-geeky side hobby of collecting vintage calculators and got my hands on a pair of HP calcs. The more I learned about the internals of the devices, the more intrigued I was. Jacques Laporte...
• #### Fixing Decades-old Bugs in the HP-35

[Part 2 of the HP Calc series ] Making the JavaScript-based HP-35 microcode emulator has been a fun little project. Last time we disassembled the original bits from the ROM. I say “disassemble” but really our microcode instructions were...
• #### Project Euler Problem #8

Largest products of five consecutive digits in this 1000-digit number. open System.Numerics let digits n = Seq.unfold ( fun i – > if i = 0I then None else Some(i % 10I, i / 10I)) n let consecutive = Seq.unfold ( function (a : BigInteger) ...
• #### Project Euler Problem #11

Greatest product of four adjacent numbers (up, down, left, right, or diagonally) in this 20x20 grid: let grid = [|08;02;22;97;38;15;00;40;00;75;04;05;07;78;52;12;50;77;91;08; 49;49;99;40;17;81;18;57;60;87;17;40;98;43;69;48;04;56;62;00; 81;49;31;73;55;79;14;29;93;71;40;67;53;88;30;03;49;13;36;65;...
• #### Project Euler Problem #12

First triangle number to have over five hundred divisors. let naturals = Seq.unfold ( fun i -> Some(i, i + 1)) 1 // from prob7 let triangleNums = Seq.scan (+) 0 naturals let isFactor n d = n % d = 0 let factors n = seq { 1..int (sqrt (float n))...
• #### Project Euler Problem #13

First ten digits of sum of following one-hundred 50-digit numbers. It would be interesting to do without BigInts. Could use doubles with enough precision for just the first ten digits or some such thing, but just wanted the correct answer to plug into...
• #### Project Euler Problem #9

Pythagorean triplet where a + b + c = 1000 (2, 1) |> Seq.unfold ( fun (m, n) – >     Some([m * m - n * n; 2 * m * n; m * m + n * n],         if n + 1 < m then m, n + 1 else m + 1, 1)) |> Seq...