News for hackers. Stuff that matters.
Re:Production Languages and Toy Languages by reitzensteinm on Monday January 28, 2008 @04:57PM (#105793)
Easier, 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).
Re:Production Languages and Toy Languages by rglullis on Monday January 28, 2008 @11:23PM (#105981)
Nor it would happen in the C version. This code doesn't compile. The compiler will throw you a WTF at x = {1, 2, 3} ...
Re:Production Languages and Toy Languages by Xichekolas on Tuesday January 29, 2008 @10:38AM (#106177)
I 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.