[Haskell-cafe] Really need some help understanding a solution

Luke Palmer lrpalmer at gmail.com
Fri Mar 27 21:09:21 EDT 2009


On Fri, Mar 27, 2009 at 7:03 PM, Henning Thielemann <
lemming at henning-thielemann.de> wrote:

>
> On Thu, 26 Mar 2009, wren ng thornton wrote:
>
>  Thomas Hartman wrote:
>>
>>> Luke, does your explanation to Guenther have anything to do with
>>> coinduction? -- the property that a producer gives a little bit of
>>> output at each step of recursion, which a consumer can than crunch in
>>> a lazy way?
>>>
>>
>> It has more to do with "tying the knot" (using laziness to define values
>> in terms of themselves), though there are similarities. Take the function:
>>
>>   infZipWith f ~(x:xs) ~(y:ys) = f x y : infZipWith f xs ys
>>
>
> What about using a custom list type, that has only one constructor like
> (:), that is, a type for infinite lists?
>

Yes, that would be more correct.  However, the lazy pattern match would
still be necessary, because single-constructor types are lifted.  And as
long as you're doing that, you might as well go all the way to an infinite
binary trie.

Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090327/4d82a479/attachment.htm


More information about the Haskell-Cafe mailing list