After some thought, I think I have the definitions for left and right fold on a tree: foldrTree :: (a -> b -> b) -> b -> InternalTree a -> b foldrTree f z ILeaf = z foldrTree f z (IBranch a x y) = foldrTree f (f a (foldrTree…
Arboreal Haskell
(Chapter 7 of The Haskell School of Expression is about trees.) The first definition is of a tree with values stored only at the leaves, i.e. data Tree a = Leaf a | Branch (Tree a) (Tree a) It then gives a mapTree function (equivalent to map on a list),…
Book Sale Haul
Today was the quarterly book sale at the Culver City library. The haul: 16 Hardy Boys books The Past Through Tomorrow – Robert A Heinlein River Out of Eden – Richard Dawkins Operating Systems Design and Implementation – Andrew Tanenbaum The Design of the Unix Operating System – Maurice Bach…
Harry Potter and the Order of the Phoenix
Probably the best of the lot so far, even though it did cut a lot from the book. Mind you, the book had a lot of cuttable stuff, so that's not a bad thing. The film stuck to the plot well. A criticism perhaps is that the adult characters weren't…
Another Haskell question
Which pattern is more efficient? Pattern a: circleSumA :: [Int] -> Int circleSumA (i1 : is) = aux i1 is where aux i [] = i + i1 aux i is = i + aux (head is) (tail is) Pattern b: circleSumB :: [Int] -> Int circleSumB is = sum…
Haskell problem followup
Having read a bit of the next chapter and discovered the zipWith function, I now have a higher-order non-recursive solution to the makeChange problem, viz. makeChange1 :: Int -> [Int] -> [Int] makeChange1 amt vs = zipWith div modvs vs where modvs = scanl mod amt vs
Haskell problem
Define a function makeChange that, given a nonnegative integer amount and a list of coin denominations, returns a list of the number of coins of each denomination required to make up the amount. For example: makeChange 99 [5,1] => [19,4] i.e. 19 nickels and 4 pennies equals 99 cents. To…
Building a MAME cabinet 7
Just come back from a trip to Home Depot. I used the truck hire, which was easy. Now I also have 3 sheets of 4’x8′ 3/4″ oak ply in my basement, and I picked up a few 2″x3″x8′ studs too for cutting supports.
More wikihowery
Especially for . How to Find Headers and Libraries for C/C++ Pograms Using pkg-config.
I made a wikihow entry
How to Play Tiddlywinks.