[Haskell-cafe] lists of arbitrary depth

Johan Tibell johan.tibell at gmail.com
Tue Jul 13 05:06:59 EDT 2010


Hi Vadali,

On Tue, Jul 13, 2010 at 10:58 AM, 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?


No, a list contains a homogeneous sequence of values (i.e. a sequence of
values of the same type). If you explain what you're trying to achieve we
might be able to offer you better help.

Cheers,
Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100713/c39d51cd/attachment.html


More information about the Haskell-Cafe mailing list