[Haskell-beginners] General Hints on Improving Performance - Example DBSCAN

Robert Heumüller mailing at heum.de
Tue Jun 19 16:45:51 CEST 2012

I'm sorry the Thread title is not very helpful... I hope this is better

> Hello,
> in order to tune my brain to "functional thinking" I've decided to
> start writing some "real" programs. After having spent a couple of
> days figuring out how to translate an imperative algorithm into
> stateless haskell I beleive I've now managed a simple implementation
> of the DBSCAN clustering algorithm.
> http://privatepaste.com/e6bb4fb665
> This code has several drawbacks (and probably it doesn't work
> correctly after all) but I would like to tune its performance.
> Obviously the code calls several functions multiply with the same
> arguments. Haskell, being stateless should thus always yield the same
> resuts, correct? In this case performing the same calculations
> multiply seems pointless.
> My question: 
> How would you go about improving this code? 
> In any imperative language I would simply cache
> distances/neighborhoods in a matrix. Obviously this is not what the
> way to go in haskell?
> Thank you very much
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

More information about the Beginners mailing list