Talk:Yet Another Haskell Tutorial/Language basics

Stylistically I think it would be nicer if the factorial and exponent functions' base cases were 0. Anyone agree --82.70.93.66 18:13, 19 June 2007 (UTC)

I think the explanation of why foldr can work on infinite lists and why foldl can't should be re-worded. As a beginner, it took me *forever* to figure out what this was talking about,and the whole time I thought that the reverse of what was being said was actually true. For example, in the foldl example, it's not obvious what is meant by "going to the end of the list". What a beginner (e.g. myself) is going to think is that it's not going to the end of the list at all. Furthermore, the part about combining the initial value with the final element of the list is completely counterintuitive, because the derivation proceeds from (((1 - 4) - 8) - 5) to (((-3) - 8) - 5) which is combining the initial value with the first value of the list. The only way i was finally able to see what this explanation was talking about is by writing the entire derivation in pre-fix notation. (-) ((-) ((-) 1 4) 8) 5. When it's written like this, it's much clearer that foldl would have to evaluate an infinite list before having a concrete value for the first argument. 12.14.60.12 (talk) 22:17, 8 December 2009 (UTC)

I also think the foldr vs foldl efficiency note is very confusing. I'm very much a haskell newbie, but I've pondered over it forever, and the only case where I can figure it might make a bit of difference is when your fold is outputting a list. If your fold is outputting a single value, I don't think it matters what kind of fold you use—if your list argument is infinite, you're doomed. Personally I would leave this whole note out, but it could also be clarified. --Jonah

The Exercise that begins "Write a function that takes a list of pairs..." appears before the user has been told how to define a function. --Ellen 66.92.186.7 (talk) 19:18, 15 September 2010 (UTC)

Compatibility issue - GHC
On GHCi 7.4.1 (on Ubuntu 12.10) Char.toUpper is not in scope. One must use Data.Char.toUpper instead. To run GHCi in Haskell 98 (and force Char.toUpper into scope) compatibility mode, use: $ ghci -package haskell98 -hide-package base Maybe this is noted elsewhere and I missed it.

123.2.122.182 (discuss) 00:08, 5 January 2013 (UTC)

factorial
Hi. What about : fac n = product [1..n]

? ( www.willamette.edu/~fruehr/haskell/evolution.html ) --Adam majewski (discuss • contribs) 20:10, 28 November 2011 (UTC)