3 ms·
If you have, for example class Rational(x: Int, y: Int) { def numer = x def denom = Y } and then homework is to implement def less(th
by sampo 14y ago
If you have, for example
class Rational(x: Int, y: Int) {
def numer = x
def denom = Y
}
and then homework is to implement
def less(that: Rational) = ???
then you're gonna get 15 000 people answering with
def less(that: Rational) = numer * that.denom < that.numer * denom
and another 15 000 with
def less(that: Rational) =
numer * that.denom < that.numer * denom
and maybe a couple thousand with something like
def less(that: Rational) = numer*that.denom < that.numer*denom
(This example was taken from Scala course lectures, but some of the homework problems are as short as this.)
- eranation 14y agoyes, but none of them are that trivial... and if they were, then cheating wouldn't make much sense. e.g. the coin change algorithm, I'm sure the distribution of answers was quite unique for anyone who tried solving it alone. same for even simple things like the pascal triangle. But it's a moot argument as we need to do a real research (or ask coursera / Martin Odersky for the data, which I'm sure HN community will be happy to run some data mining on)
- pivo 14y agoActually I think some (many?) of the answers to the functional sets homework are that trivial in the sense that they're as short (or shorter) the the examples in the parent post. The only longer function was, I think, the one for which they provided a template implementation. So I think even that one would generate false positives somewhat easily.
- biafra 14y agoThe solution for the count change is already in the recommended literature (SICP). And this was mentioned in the forums.