January 26th, 2009
It’s still early days, but Wow:
A democracy requires accountability, and accountability requires transparency. As Justice Louis Brandeis wrote, “sunlight is said to be the best of disinfectants.” In our democracy, the Freedom of Information Act (FOIA), which encourages accountability through transparency, is the most prominent expression of a profound national commitment to ensuring an open Government. At the heart of that commitment is the idea that accountability is in the interest of the Government and the citizenry alike.
The Freedom of Information Act should be administered with a clear presumption: In the face of doubt, openness prevails. The Government should not keep information confidential merely because public officials might be embarrassed by disclosure, because errors and failures might be revealed, or because of speculative or abstract fears. Nondisclosure should never be based on an effort to protect the personal interests of Government officials at the expense of those they are supposed to serve. In responding to requests under the FOIA, executive branch agencies (agencies) should act promptly and in a spirit of cooperation, recognizing that such agencies are servants of the public.
All agencies should adopt a presumption in favor of disclosure, in order to renew their commitment to the principles embodied in FOIA, and to usher in a new era of open Government. The presumption of disclosure should be applied to all decisions involving FOIA.
The presumption of disclosure also means that agencies should take affirmative steps to make information public. They should not wait for specific requests from the public. All agencies should use modern technology to inform citizens about what is known and done by their Government. Disclosure should be timely.
–President Barack Obama
Read the rest in Freedom of Information Act
It’s starting to seem like Barack Obama actually gets it. I still want to see him prosecute the criminals in the Bush administration, but otherwise it’s starting to look like we’ve elected a good one for the first time in my lifetime. Fingers crossed.
Posted in Politics | 3 Comments »
January 26th, 2009
Real World Haskell, Exercise 10, p. 98: Write the words
function using list folds:
myWords :: String -> [String]
myWords s = reverse (foldr step [] (trim s))
step :: Char -> [String] -> [String]
step c [] = [c:[]]
step c acc
| (isSpace c) = acc ++ [""]
| otherwise = (take ((length acc) - 1) acc) ++ [c:(last acc)]
isSpace :: Char -> Bool
isSpace ' ' = True
isSpace '\n' = True
isSpace '\r' = True
isSpace '\t' = True
isSpace _ = False
lstrip :: String -> String
lstrip [] = ""
lstrip (x:xs)
| (isSpace x) = lstrip xs
| otherwise = x:xs
rstrip :: String -> String
rstrip s = reverse (lstrip (reverse s))
trim :: String -> String
trim = lstrip . rstrip
Moral of this exercise: you can only pass a list to ++
. You can’t use ++
to append a Char to a String. You have to append [c]
instead.
Read the rest of this entry »
Posted in Haskell | No Comments »
January 26th, 2009
OK. This is weird. WordPress has lost all my subcategories. E.g. I can assign a post to Software Development but not Software Development/Haskell. OK, I seem to have gotten them back by clicking “Add New Category.” Probably some strange AJAX bug.
Posted in Blogging | No Comments »
January 24th, 2009
The cycle
function turns a list into an infinite list by repeating it. For instance, cycle [1,2,3]
is [1,2,3,1,2,3,1,2,3...]
. I could be wrong but I don’t think you can do this one purely with folds and here’s why:
Read the rest of this entry »
Posted in Haskell | 4 Comments »
January 23rd, 2009
So I stop by my local Circuit City this evening to see if anything worth buying is on sale. I actually have a couple of items in mind. However, the game I want is selling at full list price, despite the going out of business “sale”. The camera I want is actually 10% off, at which price it is still a couple of hundred dollars more expensive than the same camera on Amazon. I do pick up one cheap game that is actually 14 cents less than the price on Amazon, sales tax included.
For all the talk about how Wal-mart killed Circuit City, I’ve never found especially good prices on electronics at Wal-mart (or Target, or K-Mart, or similar); and I’ve never found competent service at Circuity City either, even before the layoffs. It’s Amazon and eBay other web stores that are killing the big box retailers, especially for high margin items that don’t cost a lot to ship. It’s amazing that anyone still buys anything at brick-and-mortar stores like Circuit City and Best Buy.
Posted in Economics | 2 Comments »
January 23rd, 2009
myAny :: (a -> Bool) -> [a] -> Bool
myAny f [] = False
myAny f (x:xs) = foldr step False xs
where step x acc = acc || f x
I’m beginning to hate type inference. Yes the compiler can figure out the types, but the human (i.e. me) often can’t without running the compiler. Redundancy and verbosity are not bugs. They are features. Human language (e.g. English) is verbose and redundant for good reason. Redundancy helps humans understand.
The source code is not just for the compiler. Otherwise we’d write in machine language. User interface factors need to be considered in the design of programming languages.
Posted in Haskell | 5 Comments »