[Haskell-beginners] howto reason infinite lists
Brandon S Allbery KF8NH
allbery at ece.cmu.edu
Mon Jun 21 17:46:34 EDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 6/21/10 17:43 , Chaddaï Fouché wrote:
> On Mon, Jun 21, 2010 at 8:58 PM, prad <prad at towardsfreedom.com> wrote:
>> it seems to me that if we consider the list to be already built, we can
>> apply zip successively to get the next part of it, but if we think
>> recursively we start at the beginning at each recursive level and go
>> nowhere.
>
> That's a funny way to say it : to me recursive thinking has always
> been about assuming I already have a function that works on smaller
> (in some sense) cases, writing the function knowing that and then
> figuring what's the base case we're tending toward and handling it
> non-recursively. That's what recursion is about for me and I've always
> found easier to think about it like that rather than always expansing
> the recursive calls (I also find it easier than thinking iteratively
> nowadays but YMMV).
I think of it a bit like proofs: prove the base case, prove the inductive
case, therefore the proof applies to all cases (which is equivalent to being
infinite).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkwf3boACgkQIn7hlCsL25UI9ACeM7OBLjSZnUuzHmfC0ZKge4ti
n2UAoLn09TYwvUAvSTCOeJHMAQZa/3FI
=rDt7
-----END PGP SIGNATURE-----
More information about the Beginners
mailing list