Having finally finished my first read of LYAH (It took me months of reading, practicing and taking breaks to let it all sink in), I can only see one way to improve upon it: Make a video series.
I don't know enough about Haskell to pull it off (though I may try if no one's done it in a year or so). However if someone could inject the wacky sensibility* of things like LYAH, Computerphile and CodeSchool.com into a Haskell video tutorial, it would do worlds of good for the community. Better yet, if someone could make an interactive class like CodeSchool or Codecademy, that would be amazing.
* Thought I should mention that the wackiness isn't the only important part, it also needs to be properly paced. That was LYAH's other strong point, they hammer home each concept with multiple examples before moving on.
> Having finally finished my first read of LYAH (It took me months of reading, practicing and taking breaks to let it all sink in), I can only see one way to improve upon it: Make a video series.
Why? I can't think of any advantage that a video has over an article when it comes to teaching computer science. An article allows me to read and understand each concept at my own pace and rereading something I didn't quite get is trivial. All these simple things are just tedious with a video.
While I don't need videos in order to learn, I find that seeing concepts represented visually while hearing them described by someone often works better than simply reading them. I've done some of CodeSchool's courses even though I already kind of knew the material, just because seeing it presented in that format helped reinforce things.
Furthermore, having coding exercises with a checker that can tell if you've done things correctly would help a ton when it comes to actually writing Haskell code.
A video series or course on LYAH would be an amazing resource. On an aside, there's a bunch of great intermediate level video tutorials working through various projects here:
I'll chime in and mention that Learn You A Haskell is the best online Haskell tutorial I've found. I've been working through bits of it the last couple of weeks and it is excellent.
aha, i tried using 'let' on the assumption that he was just being brief, but I put a 'let' in front of each of the pattern-matching function signatures, which didn't work. Thanks.
edit: I take your last comment as "when using the REPL, it is easier not to use the REPL." :D
Since Haskell has a strong divide between compile and runtime, the REPL is this weird pseudo-runtime. It's best not to think of it like a REPL except for very simple use cases and instead think of it like a command prompt that you can evaluate some portion of Haskell in.
If you type `:help` you'll see all of the colon-commands that make up the command language. I'm not a Haskell expert, but my naive workflow tends to be a lot of usage of `:reload`. As a Lisper, I kinda feel like the colon commands should have been the default (sans colon) and one of the commands should have been `eval <haskel code>`.
It lets you do multiline stuff, and you get to see the output right away. You don't need let, or to repeat the "main = do ..." every time you want to run a block of code.
I think it's really helpful when you're starting out.
Since this is a 101, you might want to put your Haskell setup URL and any file dependencies/explanations of Haskell's idiosyncrasies at the top of the tutorial. A 101 is aimed at people who don't know anything about the language and assuming knowledge is a good way to ensure folks get frustrated and never come back.
Every newer language can do "this". First class functions and anonymous functions have been a standard feature for a while. Does not mean that say Lua or Ruby are functional programming languages. If you just require the ability to pass around anonymous functions even C++ is a functional programming language these days.
To meaningfully distinguish functional from imperative programming you have to add purity/immutable data to the definition at least.
Perhaps helping users get set-up should be the first thing you address.
Also, you start off by saying the examples should work well in ghci but then show examples that are not run in ghci.
I fear your experience is blinding you to the numerous little things that trip up newcomers.
You might also state upfront what you assume the reader already knows. Such as the existence, and use, of ghci.
If you are mentioning ghci at the start then maybe show the examples as run in ghci. Or, if you prefer files, then explain how to run a file from the command line.
Yeah, the statement at the top that "you can run most of these examples in ghci" really tripped me up. On one hand, it gave me the clue that the haskell REPL is called "ghci", so I just went to my ubuntu box and typed "ghci" and got told I needed to install "ghc", which I did and was on my way. On the other hand, the examples weren't actually able to be run in ghci. :/
1. paste all (well most, I haven't verified it to say all) of the functions in "anyfile.hs"
2. cd to the same directory as anyfile.hs in terminal
3. open ghci
4. :load anyfile.hs
5. Play with the functions!
Also you should make sure that those who hit the cpp problem don't get overwhelmed. I've actually spent some time this week working out a patch that will make the cpp problem tst hit OS X IMPOSSIBLE to have in the future. Did require learning some autoconf thogh :-)
It's actually [n!e] - 1 where [x] the greatest integer less than or equal to x and e is the base of the natural logarithm. As nbouscal points out, the total number of heads is H=n!(1+1/1!+ 1/(n-1)!). Using the Taylor series for e^x, H = n!e - n!(1/n! + 1/(n+1)! + ...) = n!e - 1 - r, where r = (1/(n+1) + 1/(n+1)(n+2) ...). The remainder term r is easily seen to be less than 1, and H is and integer, so H=[H+r]=[n!e]-1.
http://learnyouahaskell.com/starting-out#an-intro-to-lists