[Haskell-beginners] Traversing generic trees
Ali Baharev
ali.baharev at gmail.com
Thu Jul 23 16:48:49 UTC 2015
Dear All,
I used to work at the University. Whenever a student asked me a
question, I first focused on the question and tried to answer it.
Sometimes the question was tough, maybe because there wasn't any easy
solution to the problem. In those situations I used to say to my
students: “Problem well spotted, unfortunately I cannot give you an
answer / there is no easy solution to this problem.” However, I have
never started questioning the questions of my students, especially
when I could not give them an answer.
According to the Wiki on beginners at haskell.org: "Here, there is no
such thing as a 'stupid question.'" If you start questioning my
question, then I really do not know where to go...
You might as well say: The whole question is pointless, just use
Data.Tree and be done with it!
It is really not part of the original question, and I sooo not want to
get into a discussion over this: It is important to have language
support for helping humans to input data, without a full-blown parser.
Examples would be user-defined implicit type conversions and
user-defined literals in other statically typed languages.
OK, let's get back to the original question.
Apparently, there is no easy way to solve it with nested lists.
However, no one has touched the nested tuples so far. How can I write
a toString function that works similarly to mine but destructures
arbitrarily nested tuples?
Thanks,
Ali
On Thu, Jul 23, 2015 at 9:41 AM, Imants Cekusins <imantc at gmail.com> wrote:
> .. on the other hand, if facing this problem:
> - import large trees from concise human-readable representation as string
>
> , it is probably possible to write a parser which does just that.
>
> After all json parser works somehow ;)
>
> Just saying that you could do this in Haskell, given enough interest.
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
More information about the Beginners
mailing list