How to detect finite/infinite lists?
Juanma Barranquero
lektu at terra.es
Thu Sep 18 23:43:40 EDT 2003
On Thu, 18 Sep 2003 15:53:12 -0400, Derek Elkins <ddarius at hotpop.com> wrote:
> In Haskell 98, no. With a slightly impure extension (observable
> sharing) sometimes but in general, no.
Interesting.
> just use a data structure that says, "an
> infinity of x". The simplest thing I would think of is to follow the
> arithmetic operation exactly.
>
> data SN
> = Zero
> | Up
> | Down
> | SN :+: SN
> | SN :*: SN
> | SN :^: SN
> | Omega SN
:)
Thanks,
/L/e/k/t/u
More information about the Haskell-Cafe
mailing list