Hacker News new | past | comments | ask | show | jobs | submit login

> 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/




I 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


Iterate also breaks the count function. Or did the last time I tried to use it.


What do you mean?


Just 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 - Apparently it's known and they intend to remove it in 2.0, which isn't out yet.


good to know, thanks




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: