Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't really like 'where n' afterwards instead of say 'let n' at the beginning, but I'm not very familiar with haskell (really just enough to know the first line is a type signature) and I found this ok. Maybe objective C is better though.


You can write code without ever using `where ...` :)

It's just how mathematicians are used to express their version of "top down problem solving". It's also similar to what you do when you define a function/method before the smaller ones it calls and before the even smaller ones they call (using what's called "function hoisting" in Javascript for example).

Now, if you really dislike "top down problem solving", you might have an allergic reaction to `where ...` which applies the same pattern but does it down even to the micro level of small functions of few lines...


My first thought, too. OTOH, with indentation like in the example I could live with it.


Indentation is always like in the example. Haskell has either semantic whitespace of braces everywhere, and nobody uses the braces.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: