I miss Lisp
medium.com
medium.com
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? (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)))