3 ms·
That argument is not invalid, but the counter-argument is that the functional version does a much better job of capturing the intention of the code, rather than
by sanderjd 12y ago
That argument is not invalid, but the counter-argument is that the functional version does a much better job of capturing the intention of the code, rather than the procedure of it. The intention is to get the sum of the squares of the first 10 numbers counting from 1. My gut tells me that I have fewer bugs when I'm capturing intention rather than process, but I won't claim that it's definitely true.
(Not to say this is an example of bug-due-to-process-over-intention, but you do have a bug – you're summing from 0 to 9 instead of 1 to 10.)
- deleted 12y ago[deleted]
- jheriko 12y agowhy is it not valid? these things are part of the libraries involved. as languages both Haskell and C++ are extremely free form to the point where you can abuse them into behaving like domain specific languages. or do you mean the bit about it being less code and easier to read? well done on catching the bug. :) this is my own fault for being sloppy and not paying attention.
- sanderjd 12y agoYou (understandably, due to the double-negative) misread! I said it is not invalid. Which was really a weaselly way of saying that it's valid but I don't really agree with it – sorry about that!