4 ms·
I miss Lisp
- joegreen 11y ago"forgetting to add brackets when expanding a single-line if clause (and Eclipse will nag me about unnecessary brackets if I try to play it safe)" - I believe that putting every if clause's body (even one-liners) inside brackets in Java is a good practice and I have never seen Eclipse telling it's bad.
- tomjen3 11y agoHe can just set eclipse to require the brackets or make them optional.
- restalis 11y ago"But a combination of curly braces, parentheses, brackets, periods and commas is simpler and more succinct?" It's more readable. Brackets usually implies array offsets, parentheses implies function or priority inside literal expressions, curly braces define boundaries of functional or structural contexts. If you'll think about it you'll realize that in would actually have been possible in a language like C to make use only of parentheses, relying on their position for syntax. Get this: int get_prime (int a) /* vector-using function */ ( /* the second pair of parentheses in a * function definition is for its actual * context (and likewise for the rest (of * the content (blocks))) */ int vector(100); vector(0) = 2; for (int i = 1; i < a; i++) ( for (unsigned int j = vector(i-1) + 1; j != ~0; j++) ( int k = 0; for (; k < i; k++) ( if (j % vector(k) == 0) ( break; ) ) if (k == i) ( vector(i) = j; break; ) ) ) return vector(a); ) Now it's almost as annoying to read as it would have been if written in Lisp, isn't it?
- lispm 11y agoWe can compare it to the Lisp version: (defmethod get-prime ((a integer)) (let ((vector (make-array 100))) (setf (aref vector 0) 2) (loop for i from 1 upto a do (loop for j from (1+ (aref vector (1- i))) do (when (= i (loop for k below i until (zerop (mod j (aref vector k))) finally (return k))) (setf (aref vector i) j) (return)))) (aref vector a)))
- irascible 11y agoNobody cares.