3 ms·
In addition, the use of cryptic variable names like s, e, d or j with big block comments describing what each one stands for is particularly irritating.
by sleazebreeze 13y ago
In addition, the use of cryptic variable names like s, e, d or j with big block comments describing what each one stands for is particularly irritating.
- akalin 13y agoThanks for the feedback! In my defense, I can only say that I was a less-experienced coder when I wrote that. :) The comments were intended to extend the preceding prose explanation rather than being comments per se. The actual code is not much longer than the naive version, though, so if I get around to writing an updated version, I'd probably find some other method of conveying that info. Some other things I'd do differently if I were to update it today: - I'd write it in Javascript and provide a little interactive applet to play with it. (Similar to my posts on primality testing: http://www.akalin.cx/intro-primality-testing http://www.akalin.cx/intro-primality-testing and http://www.akalin.cx/primality-testing-polynomial-time-part-2 http://www.akalin.cx/primality-testing-polynomial-time-part-... .) - I'd upload the code to GitHub. - I'd add unit tests. Cheers!
- sleazebreeze 13y agoNo offense was meant, no defense is necessary. Putting your code out there for HN to critique is indeed an admirable action. Your humility is even more admirable. Your links on primality testing are particularly relevant to me as I just finished that section in SICP - thanks for the links!