[Haskell-beginners] Re: [Haskell-cafe] lists of arbitrary depth
Christopher Done
chrisdone at googlemail.com
Tue Jul 13 05:00:53 EDT 2010
On 13 July 2010 10:58, vadali <shlomivaknin at gmail.com> wrote:
>
> hello,
> iam really new to haskell,
>
> i want to define a function which takes as a parameter a list which can
> contain other lists, eg. [1,[2,3],[4,[5,6]]]
>
> how would i define a function that can iterate through the items so (in this
> example)
> iter1 = 1
> iter2 = [2,3]
> iter3 = [4,[5,6]]
>
> ?
>
> ( can i do that without using the Tree data type? )
Maybe this should be moved to Haskell-Beginnners.
It's impossible to have a function that works on a list of arbitrary
nesting. But you could use a tree data type, yeah.
More information about the Beginners
mailing list