Archive for the ‘Uncategorized’ Category

Real World Haskell: Chapters 1 and 2

Wednesday, May 13th, 2009

Notes: not really anything noteworthy for me in these chapters.  I already speak a bit of Haskell.

Quotes:

Because the result of applying a pure function can only depend on its arguments, we can often get a strong hint of what a pure function does by simply reading its name and understanding its type signature. As an example, let’s look at not.

ghci> :type not
not :: Bool -> Bool

Even if we didn’t know the name of this function, its signature alone limits the possible valid behaviours it could have.

  • Ignore its argument, and always return either True or False.
  • Return its argument unmodified.
  • Negate its argument. 

We also know that this function can not do some things: it cannot access files; it cannot talk to the network; it cannot tell what time it is. 

Purity makes the job of understanding code easier. (emphasis mine) The behaviour of a pure function does not depend on the value of a global variable, or the contents of a database, or the state of a network connection. Pure code is inherently modular: every function is self-contained, and has a well-defined interface.

– pp39-40

As a formalist, I’m all about reasoning about type signatures for things.  When I design larger systems, I’m always looking for the type of information being passed around, then looking at how to turn one stage’s input format into the input format of the next stage.  This is partly based on my experience with functional languages, and partly based on an old programming maxim: “Show me your flowcharts and conceal your tales, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; it’ll be obvious.” (Brooks, The Mythical Man-Month, Ch9)

Takeaway:

Reading through the first two chapters of Real World Haskell reminded me just how bizarre learning OCaml was the first time around.

A new coworker recently mentioned Scala as something he enjoyed; I’ll probably give it a go soonish, to see how it fits.  I really like the feel of Haskell, and the community seems to be vibrant and growing.  About two years ago, I stopped using OCaml for anything, and started lurking around Haskell.  After a bit of prodding and coaching by my friend Evan, I mostly came to understand monads, but am still a little rough on the details.  Hopefully the process of reading through Real World Haskell will refine this, and let me knock out some interesting algorithmic code in Haskell.

What the heck does "hypomnemata" mean, anyway?

Tuesday, May 12th, 2009

Once again, I’m lowered to just quoting wikipedia for you:

Plato’s theory of anamnesis recognized the new status of writing as a device of artificial memory, and he developed the hypomnesic principles for his students to follow in the Academy. The hypomnemata constituted a material memory of things read, heard, or thought, thus offering these as an accumulated treasure for rereading and later meditation.

Wikipedia: Hypomnema

Basically, hypomnema is ancient Greek for “notes.”  Writing was relatively new, so it was kind of groundbreaking to crystallize your thoughts in a form to which you could return.  This allowed people to go from “Err, it seemed like a good idea at the time” to “We believed this to be true from the following evidences.”  Hypomnemata were thus the birthplace of the lab notebook and the primoridal stirrings of data, which is kind of incredible to think about.

In that tradition, this blog will contain my personal technical notes: reading notes, lab notes, etc.  Since it’s a collection of multiple different notebooks, I’m calling it the plural “hypomnemata” instead of “hypomnema.”