5 ms·
> coalton is not lispy, sure, but neither is the loop macro, yet it is probably the most powerful looping mechanism in any language :) I would argue that itera
by nemoniac 4y ago
> coalton is not lispy, sure, but neither is the loop macro, yet it is probably the most powerful looping mechanism in any language :)
I would argue that iterate is more powerful as well as being more lispy in the sense that it's extensible and macro-programmable.
https://iterate.common-lisp.dev/ https://iterate.common-lisp.dev/
- Jtsummers 4y agoIterate also breaks the count function. Or did the last time I tried to use it.
- maydup-nem 4y agoWhat do you mean?
- Jtsummers 4y agoJust checked and this is still a problem. Try this code with Iterate: (let ((list '(1 2 3 4 1 2 3 4))) ;; or whatever other sequence (iter (for i from 1 to 10) (sum (count i list)))) It will error out on you. The same works fine with loop: (let ((list '(1 2 3 4 1 2 3 4))) (loop for i from 1 to 10 sum (count i list))) ;; => 8 Now, that's a bit contrived as an example, but an iteration library should not break a standard library function call. https://gitlab.common-lisp.net/iterate/iterate/-/issues/12 https://gitlab.common-lisp.net/iterate/iterate/-/issues/12 - Apparently it's known and they intend to remove it in 2.0, which isn't out yet.
- maydup-nem 4y agogood to know, thanks
- martinflack 4y agoI like the lispiness and features of ITERATE but it breaks source location for debugging errors in SBCL with SLIME. Instead the ITER form is indicated, which dampens my enthusiasm for it somewhat. (defpackage :test (:use :cl :iterate)) (in-package :test) (defun test-iter () (declare (optimize (debug 3) (safety 3) (speed 0))) (iter:iter ;;; <-- highlights whole ITER form (sleep 2) (error "test"))) (defun test-loop () (declare (optimize (debug 3) (safety 3) (speed 0))) (loop :do (sleep 2) :do (error "test"))) ;;; <-- highlights ERROR form