[Haskell-beginners] first open source haskell project and a mystery to boot

Brent Yorgey byorgey at seas.upenn.edu
Fri Oct 14 00:05:19 CEST 2011


On Thu, Oct 13, 2011 at 11:49:29AM -0700, Alia wrote:
> <snip Brent Yorgey's very helpful reply>
> 
> Brent, many thanks for taking the time to think about this. I think your 
> solution totally makes sense, and compiles well.
> 
> The only thing is that when one tries to run t5 through 
> the runDecisionTree function things get a little weird:
> 
> *ID3> runDecisionTree t5 (head items)
> *** Exception: Prelude.head: empty list

It must be a problem with the ID3 implementation itself.  'items' is
obviously not empty.  So the error must be coming from one of the
calls to 'head' in the ID3 implementation (of which there are
several).  The original author (whoever they were) ought to be ashamed
of him/herself.  Having bugs in your implementation is excusable, but
using functions like 'head' which can crash is not! ;)

-Brent



More information about the Beginners mailing list