Hi, I think there is a typo in the definition of the function "tree", in the module "Ldfs.hs", which is in the demos directory of the hugs distribution. The original definition is:
tree :: Bounds -> Forest Vertex -> Graph
tree bnds ts = buildG bnds (concat (map flat ts))
where flat (Node v rs) = [ (v, w) | Node w us <- ts ] ++
concat (map flat ts)
I think it should be:
tree :: Bounds -> Forest Vertex -> Graph
tree bnds ts = buildG bnds (concat (map flat ts))
where flat (Node v rs) = [ (v, w) | Node w us <- rs ] ++
concat (map flat rs)
The difference is that I have changed "ts" to "rs" in the body of the
function "flat".
By the way, I find Ldfs very useful and I think it deserves a place amongst
the libraries. I have attached a modified version of Ldfs that I often use.
It is based on FiniteMap and Set, rather than arrays, because I tend to
find that my graphs do not use integer indices. Of course, this means that
my version is less efficient than the original and does not use LazyST, but
I have never yet had any problems with its performance. Provided that
Professor Launchbury agrees, would it be possible to add it to the
libraries? If some work needs to be done to bring it into line with
existing style guides, then I am happy to do this.
Kevin
(See attached file: Ldfs.hs)
Kevin Backhouse, Software Engineer
ARM Limited
110 Fulbourn Road, Cambridge, CB1 9NJ, UK.
Tel: +44 1223 400601
This e-mail message is intended for the addressee(s) only and may contain
information that is the property of, and/or subject to a confidentiality
agreement between the intended recipient(s), their organisation and/or the
ARM Group of Companies. If you are not an intended recipient of this e-mail
message, you should not read, copy, forward or otherwise distribute or
further disclose the information in it; misuse of the contents of this
e-mail message may violate various laws in your state, country or
jurisdiction. If you have received this e-mail message in error, please
contact the originator of this e-mail message via e-mail and delete all
copies of this message from your computer or network, thank you.
Ldfs.hs
Description: Binary data
