[Haskell-beginners] growing trees

Jeff Lasslett jeff.lasslett at gmail.com
Sat Aug 4 07:07:51 CEST 2012


Hello again,

There were a few details I accidentally omitted from my initial email.

I've attached my code again.

As I mentioned in my first message on this subject, I'm just after
some guidance on ways to improve upon what I've written.  How can I
make it clearer, more concise??

Here's a transcript of a ghci session showing how I generate a tree
from a list of associations:


*AssocTree> let related = filterUnrelated assocs
*AssocTree> let t = growTree ( Node r [] ) related
*AssocTree> printTree t
root
|
+- C
|  |
|  +- f
|  |
|  +- e
|  |  |
|  |  `- m
|  |
|  `- D
|     |
|     +- g
|     |  |
|     |  +- i
|     |  |
|     |  `- j
|     |     |
|     |     `- k
|     |
|     `- h
|
+- B
|
`- A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AssocTree.hs
Type: application/octet-stream
Size: 2670 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120804/08ad1cfb/attachment-0001.obj>


More information about the Beginners mailing list