
2009/3/10 Heinrich Apfelmus
Sergey V. Mikhanov wrote:
... some code ...
What would you do different (including stylistic changes)? What are the general comments about efficiency (not of the algorithm, but of the implementation: for example, is it fine to use break at every invocation of doFactors?) and elegance of the solution?
Stylistically, one usually uses shorter variable names in Haskell.
<beginner rant> Sometime too short peraphs? At least, this is one of the things that slows down my understanding of code posted on this list on or on various haskell tutorial. In any other language I know, programmers learn to give meaningful names to variable and functions, so when one reads a program, one can use the name to remember what the function does. Then one cames to haskell ... I guess the short names comes from mathematic background, but still ... haskell is already very succint - even more so when you use pointfree programming - and if one also uses names like a,e,i ( look at Array function definitions ), ... Rant apart, I notice that in my own excercises I tend to shorten names, so maybe there is a reason for that. Nevertheless readability tends to be a big issue in languages used in IT industry, and my feeling is that haskell tends to err on the laconic side of the balance. Out of curiosity, there is any reason why you called the auxiliary function 'go' ? Ciao ------- FB