26Jan

Scientific Progress!

Posted by Elf Sternberg as Uncategorized

“The most exciting phrase to hear in science, the one that heralds new discoveries, is not ‘Eureka!‘ (‘I found it!’) but rather ‘hmm….that’s funny…'” – Isaac Asimov

I had that very experience this evening.  It’s funny what gives you insight, what makes you understand.  I’ve been trying to wrap my head around the whole idea of Haskell’s type, typeclass, data, and instance, and just not getting it.  It wasn’t clicking for me at all.  I went back to chapter 2 (!) of Real World Haskell and started working through the problems again, and I hit this example:

ghci> lines "the quick\nbrown fox\njumps"["the quick","brown fox","jumps"]

And being a good little student I meant to type:

ghci> :t lines

But being a lazy student I used keyboard shortcuts to summon the previous example. I ended up with this:

ghci> :t lines "the quick\nbrown fox\njumps"
lines "the quick\nbrown fox\njumps" :: [String]

And the lights totally went on. Because I realized that the expression to the left of the :: symbol is not “an lvalue”, it’s just a value. If you don’t understand Haskell, why that’s a big deal might not make sense to you. But I get some of it now.

Comment Form

Subscribe to Feed

Categories

Calendar

January 2012
M T W T F S S
« Dec   Feb »
 1
2345678
9101112131415
16171819202122
23242526272829
3031