Not impressed. Lisp’s LOOP macro did it 40 years ago:
First example:
(loop for (x y) on (cons 0 arr) by #'cddr counting (and (= 0 x) (= 1 y)))
Second example:
(loop for (x y z) on '(0 1 2 3 4 5 6 7 8 9 10 11 12) by #'cdddr do (format t "~a ~a ~a~%" x y z))
It’s slightly longer, but also more readable, IMO. And not that it matters here, but the Lisp version will probably run ~20-50x faster by default.
Not impressed. Lisp’s LOOP macro did it 40 years ago:
First example:
Second example:
It’s slightly longer, but also more readable, IMO. And not that it matters here, but the Lisp version will probably run ~20-50x faster by default.