2,871 reputation
1330
bio website
location Argentina
age 38
visits member for 4 years, 3 months
seen 5 mins ago

Software developer and science fiction fan.


2d
revised Software paradigms: prove that sum and sum1 are equal
added a more appropriate tag; still better would be "induction" or "proof" ("scala" hs nothing to do with this question)
2d
revised Software paradigms: prove that sum and sum1 are equal
code formatting
2d
comment Software paradigms: prove that sum and sum1 are equal
An idea: prove by induction that k + sum1(xs, 0) = sum1(xs, k). Then use it in the step you're currently stuck.
May
14
comment Is it possible to Style a csv file?
@quangphan Java is irrelevant for this question. You can't style a CSV (unless you use proprietary extensions), regardless of what programming language you are using to write it.
May
9
comment JUnit Testing in Multithread Application
Please note that these tests won't prove your concurrency issues don't exist anymore. They simply exercise your threads more, and therefore increase the chance of finding concurrency problems if they are there; but I'm afraid this is still no guarantee. Finding and troubleshooting concurrency problems is unfortunately very hard.
May
9
comment JUnit Testing in Multithread Application
JUnit is not only used for unit testing, but also for integration testing. It's very hard to unit test concurrency problems, and the OP doesn't seem to be asking about unit testing, but about automated (integration) testing.
May
7
comment Why is .compareTo() in an interface while .equals() is in a class in Java?
possible duplicate of Java: why is there a Comparator interface but no Hasher and Equator?
May
7
revised Should we define types for everything?
Removed irrelevant tags; the question isn't about OOP or FP, but just about type systems
May
6
comment Why is Lisp useful?
The article by Paul Graham is interesting because, save for a couple of items, most languages these days seem to have the features he lists. So maybe Lisp was more compelling back in those days; nowadays it's more valuable as the language that introduced those features?
Apr
17
comment What exactly makes the Haskell type system so revered (vs say, Java)?
+1 Great answer! This is very powerful and often underappreciated by newcomers to Haskell. By the way, a simpler "impossible" function would be fubar :: a -> b, wouldn't it? (Yes, I'm aware of unsafeCoerce. I assume we aren't talking about anything with "unsafe" in its name, and neither should newcomers worry about it! :D)
Apr
17
comment What exactly makes the Haskell type system so revered (vs say, Java)?
+1 Though it would help explaining that other languages also have Maybe (e.g. Java's Optional and Scala's Option), but in those languages it's a half-baked solution, since you can always assign null to a variable of that type, and have your program explode at run-time. This cannot happen with Haskell [1], because there is no null value, so you simply cannot cheat. ([1]: actually, you can generate a similar error to a NullPointerException using partial functions such as fromJust when you have a Nothing, but those functions are probably frowned upon).
Apr
17
comment best practices for packaging in Scala projects?
Are you talking about Scala package conventions? If so, have you taken a look at the Style Guide?
Mar
31
comment Does path coverage guarantee finding all bugs?
+1 I like this answer because it's constructive and mentions some of the benefits of coverage.
Mar
31
comment Ethicality of online license checks
Nitpick: Piracy is the wrong term for this. Because these are legitimate users (i.e. paying customers), at worst they are violating the terms of your license, but they are not pirating or using pirated software.
Mar
30
comment Does path coverage guarantee finding all bugs?
Good point. Agreed.
Mar
30
comment Does path coverage guarantee finding all bugs?
Agreed that that's part of the issue, but the real issue is more fundamental than that. Even with a theoretical computer with infinite memory and no concurrency, 100% test coverage does not imply the absence of bugs. Trivial examples of this abound in the answers here, but here is another: if my program is times_two(x) = x + 2, this will be fully covered by test suite assert(times_two(2) == 4), but this is still obviously buggy code! No need for memory leaks :)
Mar
30
comment Does path coverage guarantee finding all bugs?
@JørgenFogh Path coverage doesn't let you know whether the program halts. That's not the formulation of the halting problem. (Trivial counterexample: f x = if x == 0 then 1 else f (x - 1) can be fully path-covered with inputs 0 and 1, but doesn't halt for -1. And regardless, the comparison was with finding all bugs via path coverage, not with path coverage itself)
Mar
30
comment Does path coverage guarantee finding all bugs?
@Leushenko In other words, the answer could be "for some non-Turing complete languages, path coverage is NOT like the halting problem". However: a- that's not what the OP seems to be asking, b- it still doesn't answer whether path coverage is enough to find all bugs! (I'm not familiar with Coq et al, but I'm going to risk that the answer is still "no").
Mar
30
comment Does path coverage guarantee finding all bugs?
@Leushenko Agreed, but that's not the case here, is it? We're talking about a general guideline for programming languages: "is path coverage good enough?". In the general case for general purpose languages, this is similar to the halting problem, and the answer is "no, it's not good enough". We are obviously not talking about Coq here; and if you're using a small enough subset of C, then this is not within the constraints of the original question (e.g. the C lang subset that is only printf("hello world\n") can be covered and shown to be bug-free... but not what we're discussing here).
Mar
30
comment Does path coverage guarantee finding all bugs?
@JørgenFogh But when trying to find bugs in any program, isn't it a priori unknown whether the program halts or not? Isn't this question about the general method of "finding all bugs in any program via path coverage"? In which case, isn't it similar to "finding whether any program halts"?