5 ms·
Looks awesome. I think exercise 1.2 is broken. I enter in: (/ (+ 5 (+ 4 (- 2 (- 3 (+ 6 (/ 4 5)))))) (* 3 (* (- 6 2) (- 2 7)))) and it tells me the result is w
by BlackJack 14y ago
Looks awesome. I think exercise 1.2 is broken. I enter in:
(/ (+ 5 (+ 4 (- 2 (- 3 (+ 6 (/ 4 5)))))) (* 3 (* (- 6 2) (- 2 7))))
and it tells me the result is wrong, but wolfram and my own REPL confirms the result.
- vhf 14y agoI came up with the same solution and had the same wrong result.
- sur 14y agoI think it expects you to combine the addition and multiplication, like this: (/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5))))) (* 3 (- 6 2) (- 2 7)))
- zodiac 14y agoThe autograder checks for (+ 5 4 (- 2 ...)), instead of nesting the additions. You can view the source to see the grader. I'm not sure how to make it accomodate all the ways it could be nested though.
- BlackJack 14y agoWhy not check the result and also check for the presence of parentheses? That way you can verify the result and make sure nobody's just copying and pasting in an answer. One could easily do something like (-2.466..) as the answer, but given that you just need a simple way to verify answers, I think my strategy works well.
- FuzzyDunlop 14y agoI think you could get away with not even checking for parens, if you go with the idea that people doing it properly won't try to cheat it (because they'll learn nothing). For people who do want to 'cheat', the grade is meaningless anyway.
- BlackJack 14y agoI thought about that, but my reasoning for checking parens is that there's a decent subset of people who might get stuck and just google an answer, but if it gets rejected, then they'll put more time into figuring out the correct answer. I guess I'm trying to view it from the POV of a beginner, as most CS people/programmers can work through this without needing the website.
- jQueryIsAwesome 14y agoNormalize it and then check if it is equal; this took longer than I like to admit: http://jsfiddle.net/jeKMF/ http://jsfiddle.net/jeKMF/