4 ms·
I personally think that C++ and Java are less readable then Lisp, Python, Ruby, ... I think you get used to every Syntax. The point is, Lisp et al are much mor
by zyroth 19y ago
I personally think that C++ and Java are less readable then Lisp, Python, Ruby, ...
I think you get used to every Syntax. The point is, Lisp et al are much more compact, which makes the concepts easier to grasp.
I get a (mapcar #'f '(1 2 3)) much quicker than a
x = {1, 2, 3};
for (int i = 1; i < 4; i++) {
x[i] *= 2;
}
- Xichekolas 19y agoWell in all fairness it would be: (mapcar #'(lambda (x) (* x 2)) '(1 2 3)) vs x = {1, 2, 3}; for (int i = 1; i < 4; i++) { x[i] *= 2; } (I think... my only real experience is with Scheme, so I'm sure I messed up the pound-tick or some parens in Lisp) But yeah, I generally agree the Lisp version is easier... especially once you get past trivial stuff like this.
- reitzensteinm 19y agoEasier, but more importantly safer in that any potential memory trashing code is implemented inside the language implementation itself (the bug that's in your C version couldn't really happen in the Lisp version).
- rglullis 19y agoNor it would happen in the C version. This code doesn't compile. The compiler will throw you a WTF at x = {1, 2, 3} ...
- Xichekolas 19y agoI was just assuming the zyroth's example was in Java, since that is what the article's author favored. Not sure where you guys got the idea that it was C. But, just to cover all bases, it wouldn't work as Java either. This would though. int[] x = {1, 2, 3}; for (int i = 0; i < 3; i++) { x[i] *= 2; } Yet another reason to use: (mapcar #'(lambda (x) (* x 2)) '(1 2 3)) ... you don't have to think about whether array indexes start at zero or one.