in reply to Re^15: World's shortest intro to function programming
in thread Thread on Joel on software forum : "I hate Perl programmers."

Hmmm. Seems I used the tab key instead of the space key for that one line. Looked fine in my editor and I didn't notice the difference in the post till I just looked back.
Significant whitespace can introduce some strange looking error messages (tabs are a tool of the devil).
I've tried this with Haskell, but it is so different, not just in the layout, but the entire way of structuring the program, that even the simplest of real world examples leaves me wondering where to start.
Yeah, its a real mindbending experience for a while, what with all the recursion and lack of state and partially applied functions and lazy evaluation and type inference and significant whitespace and unfamiliar syntax/precedence-rules/semantics (whew!). So I really encourage you to get a book to help you out on your new journey. (And if you get a used book and you don't like it, you can probably sell it back for about the same as you paid for it, less postage and tax)
Simple example: When should I use data, when type or newtype?
If you know C, think of "data" like "struct" and "type" like "typedef". A "newtype" is just like "data", with only one type constructor (which gets optimized away at runtime).
  • Comment on Re^16: World's shortest intro to function programming