The only reason the first version of fib was used in the Gentle Intro was to demonstrate recursive stream processing...
Thank you for the explanation. For reference, the fib example occurs in a section (3.4) titled "'Infinite' Data Structures", of which I believe the simpler function is also an example. There is no reference in this section to recursive stream processing (this occurs in section 4.4). In any case, as a newbie, I can tell you that I found the fib function puzzling as stated.
...and not to show a "canonical" version of Fibonacci
Nonetheless, it seems to have become the canonical version. For example, see the list of references to this version on Google: http://www.google.com/search?q=%22zip+fib+%28tail+fib%22. This is perhaps unfortunate since fib is a kind of "hello world" for Haskell and other FP languages. -- Brian
In any case, as a newbie, I can tell you that I found the fib function puzzling as stated.
...and not to show a "canonical" version of Fibonacci
Nonetheless, it seems to have become the canonical version. For example, see the list of references to this version on Google: http://www.google.com/search?q=%22zip+fib+%28tail+fib%22.
This is perhaps unfortunate since fib is a kind of "hello world" for Haskell and other FP languages.
Well, I cannot speak for the other references, since I did not write them :-). On the other hand, stream processing *is* a stylistic way to write certain kinds of functional programs, with the idea of replacing an iteration with a stream. But I agree that this particular example should not be the equivalent of "hello world". (Of course, for that, one would just write: print "hello world" :-) -Paul
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 05 February 2002 21:08, Paul Hudak wrote:
Well, I cannot speak for the other references, since I did not write them :-). On the other hand, stream processing *is* a stylistic way to write certain kinds of functional programs, with the idea of replacing an iteration with a stream. But I agree that this particular example should not be the equivalent of "hello world". (Of course, for that, one would just write:
A stream is still an iteration. I think fibonacci (series) function is best represented as a recursive function, and if you want to show that functional languages look a bit like mathematics then that is how it should have been demonstrated. All that juggling in the original version Brian complained about may have arisen from efficiency considerations (was it the case?), however such considerations do not have any pedagogic use. [*] And as I had pointed out before, that tutorial is not at all the brightest piece of introductory documentation when you compare it to certain printed texts for Haskell programming language. (In any case, the ocaml tutorial seems to me better designed than haskell's 'gentle' introduction.) Brian would probably be much more comfortable with a decent book.... Thanks, [*] If I had to teach someone the horrible C language, I would not start with "goto" statement that might make a performance difference in certain codes. (And "goto" is used in C codes when it will be efficient) - -- Eray Ozkural (exa) <erayo@cs.bilkent.edu.tr> Comp. Sci. Dept., Bilkent University, Ankara www: http://www.cs.bilkent.edu.tr/~erayo GPG public key fingerprint: 360C 852F 88B0 A745 F31B EA0F 7C07 AE16 874D 539C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8ZJ71fAeuFodNU5wRAm14AKCABDvMa3CQNSIo3pHEWNzTR7MLqgCbBrqk UPlVeY4HBspBPXW3PJ1LqMc= =Y7DF -----END PGP SIGNATURE-----
At 10:00 PM -0600 2/8/02, Eray Ozkural (exa) wrote: ...
And as I had pointed out before, that tutorial is not at all the brightest piece of introductory documentation when you compare it to certain printed texts for Haskell programming language.
That comparison is not valid. In its introduction, the tutorial to which you refer notes that Our goal is to provide a gentle introduction to Haskell for someone who has experience with at least one other language, preferably a functional language ... http://www.haskell.org/tutorial/ The tutorial link in http://www.haskell.org/bookshelf/ bears this caution: The title is a bit misleading. Some knowledge of another functional programming language is expected. So the reader is adequately warned that this is not an introduction to functional programming. One who stumbles into a tutorial for which he is not yet ready does himself no credit by blaming the tutorial. --HR ------------------------------------------------------------------ Hamilton Richards Department of Computer Sciences Senior Lecturer Mail Code C0500 512-471-9525 The University of Texas at Austin Taylor Hall 5.138 Austin, Texas 78712-1188 ham@cs.utexas.edu hrichrds@swbell.net ------------------------------------------------------------------
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday 10 February 2002 17:12, Hamilton Richards wrote:
So the reader is adequately warned that this is not an introduction to functional programming. One who stumbles into a tutorial for which he is not yet ready does himself no credit by blaming the tutorial.
Thanks for pointing out. Nevertheless, the tutorial does have room for improvement. Regards, - -- Eray Ozkural (exa) <erayo@cs.bilkent.edu.tr> Comp. Sci. Dept., Bilkent University, Ankara www: http://www.cs.bilkent.edu.tr/~erayo GPG public key fingerprint: 360C 852F 88B0 A745 F31B EA0F 7C07 AE16 874D 539C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8Zo/dfAeuFodNU5wRAhlGAJwKUikcLID5fGOpUdH+NeGD+SO1aQCgmunh T/oYOWmv2ZXCzn6s5bJBTY8= =iKKy -----END PGP SIGNATURE-----
You are, of course, welcome to write a new tutorial that remedies the deficiencies you find in the original. I encourage you to do so. Eray Ozkural (exa) wrote:
Thanks for pointing out. Nevertheless, the tutorial does have room for improvement.
--brian
participants (5)
-
Brian Berns -
Brian Boutel -
Eray Ozkural (exa) -
Hamilton Richards -
Paul Hudak