armedbear / abcl

Armed Bear Common Lisp <git+https://github.com/armedbear/abcl/> <--> <svn+https://abcl.org/svn> Bridge
https://abcl.org#rdfs:seeAlso<https://gitlab.common-lisp.net/abcl/abcl>
Other
291 stars 29 forks source link

Fix MAPC/MAPCAR for circular lists #613

Closed easye closed 1 year ago

easye commented 1 year ago

(Alan Ruttenberg)

https://github.com/mnepveu reported issues with using circular lists in ABCL with data structures for an application which works in SBCL/CCL but would cause ABCL to hang.

The following test case no longer causes ABCL to hang:

 (setq *print-circle* t)

 (defun number-of-items (rtype datefrom dateto)
   10)

 (defun circularlist (items)
   (setf (cdr (last items)) items)
   items)

 (mapcar #'number-of-items
         '("abîmé" "administratif" "autre" "client insatisfait" "coin défecteux"
           "couleur / profil" "défectueux" "erreur créaction" "erreur du client"
           "erreur expédition" "impression" "mesure" "offset" "qualité" "transport"
           "égratignée")
         (circularlist (list "2023-07-31"))
         (circularlist (list "2023-08-07")))

Implementation from https://github.com/armedbear/abcl/issues/612#issuecomment-1667066101.

See also https://github.com/armedbear/abcl/issues/611.

Addresses https://github.com/armedbear/abcl/issues/612.

easye commented 1 year ago

Thanks @alanruttenberg for the implementation.