comparison tests/automated/lisp-tests.el @ 5355:70b15ac66ee5

Correct a bug with circularity checking in #'mapcar*, #'map, etc. src/ChangeLog addition: 2011-02-10 Aidan Kehoe <kehoea@parhasard.net> * fns.c (shortest_length_among_sequences): This was buggy, it always errored if the last argument was circular, even if other arguments were non-circular. Correct that. tests/ChangeLog addition: 2011-02-10 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: * automated/lisp-tests.el (mapcar*): If multiple SEQUENCE arguments are passed to #'mapcar*, and the last one is circular while the others aren't, make sure that #'mapcar* doesn't error.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 10 Feb 2011 08:46:10 +0000
parents 38e24b8be4ea
children 46b53e84ea7a 00e79bbbe48f
comparison
equal deleted inserted replaced
5354:22c4e67a2e69 5355:70b15ac66ee5
1043 "Devious evil mapping function" 1043 "Devious evil mapping function"
1044 (when (eq (car y) 1) 1044 (when (eq (car y) 1)
1045 (setcdr (cdr x) 42)) ; drop a brick wall onto the freeway 1045 (setcdr (cdr x) 42)) ; drop a brick wall onto the freeway
1046 (car y)) 1046 (car y))
1047 x))) 1047 x)))
1048
1049 (Assert
1050 (equal
1051 (let ((list (list pi))) (mapcar* #'cons [1 2 3 4] (nconc list list)))
1052 `((1 . ,pi) (2 . ,pi) (3 . ,pi) (4 . ,pi)))
1053 "checking mapcar* behaves correctly when only one arg is circular")
1048 1054
1049 (Assert (eql 1055 (Assert (eql
1050 (length (multiple-value-list 1056 (length (multiple-value-list
1051 (car (mapcar #'(lambda (argument) (floor argument)) (list pi e))))) 1057 (car (mapcar #'(lambda (argument) (floor argument)) (list pi e)))))
1052 1) 1058 1)