Address #196: Fix issues with mapping and nconc accumulation
This change reorders the accumulation so the next tail is saved before the current tail is appended using rplacd. This makes the behavior of mapcan equivalent to the following
(defun mapcan (f x) (cond ((null x) nil) (t (nconc (funcall f (car x)) (mapcan f (cdr x))))))
in the one argument case, which is consistent with other Lisp systems including Maclisp, where the mapcan function seems to have originated.
In doing so, this change resolves two of the defects reported in the aforementioned issue. First, it checks the value being accumulated ensure it satisfies listp. Second, it allows the creation of a circular list under certain conditions, consistent with the recursive definition shown above.
Merge request reports
Activity
added bug label
requested review from @rtoy
assigned to @cshapiro
- Resolved by Carl Shapiro
- Resolved by Carl Shapiro
- Resolved by Carl Shapiro
Generally looks good, but I gotta figure out why CI fails for you. It can't even get past the install stage. Don't know what's up with that.
- Resolved by Carl Shapiro
- Resolved by Carl Shapiro
- Resolved by Carl Shapiro
- Resolved by Carl Shapiro
Did we ever resolve all the comments in #196 (closed) and in the corresponding ansi-test/ansi-test#39?
added 3 commits
-
ba19261f...a7300f03 - 2 commits from branch
cmucl:master
- 885562be - Merge branch cmucl:master into mapcan
-
ba19261f...a7300f03 - 2 commits from branch
added 1 commit
- 48eaf690 - Address #196 (closed): Fix issues with mapping and nconc accumulation
added 1 commit
- 91e1e444 - Address #196 (closed): Fix issues with mapping and nconc accumulation
mentioned in commit 310e41eb
Thank you for the detailed investigation. I copied this change for Clozure CL. https://github.com/Clozure/ccl/issues/445