By: admin on: Jun 1,2007
In: Uncategorized
I start off confidently, typing in the first example into my scratch
file:
> data Tree = Leaf a | Branch (Tree a) (Tree a)
Of course, ghci complains bitterly, and strangely
Prelude> :l 7.hs [1 of 1] Compiling Tree [...]
By: admin on: May 30,2007
In: Uncategorized
(Haven't really had much time for Haskell this week - I had set myself the task of comparing some versions of SOE exercises, but will get back to that as soon as I can. In the mean time, another (shortish) post in the regular series...)The first part is straight forward enough. We create a [...]
By: admin on: May 22,2007
In: Uncategorized
This is an interesting chapter, working on the higher order functions
rather than actually drawing shapes.
It covers:
Polymorphic types
Principal type - this is an interesting idea, the type inferencer can
determine that something works on an Int, say, or “Number stuff”, or
“just any stuff”, or “a list of stuff”. Too general and it's no longer
useful. The [...]
By: admin on: May 22,2007
In: Uncategorized
We are presented with some coercion functions and asked
Ex 4.1: Why is inchToPixel x not defined as 100 * round
x ?
It is instead defined as round(100 * x). This is because if
rounding was done on the input parameter, then whether it was, say, 1.01
or 1.99, the answer would be the same: 100*(round 1.01) [...]
By: admin on: May 21,2007
In: Uncategorized
HTML is all very well and good, but frankly, I'm too lazy to mark up my&,<,> characters all the time by hand, at least withincode. I used the POD formatter pod2html for a couple of earlyposts. It's OK, it basically has a concept of "This is a normal textparagraph, and this is a code paragraph" [...]