Skip to content
Snippets Groups Projects

Address #196: Fix issues with mapping and nconc accumulation

Merged Address #196: Fix issues with mapping and nconc accumulation
All threads resolved!
Merged Carl Shapiro requested to merge cshapiro/cmucl:mapcan into master
All threads resolved!

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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Carl Shapiro
  • Raymond Toy
  • Raymond Toy
  • Raymond Toy
  • Raymond Toy
  • Did we ever resolve all the comments in #196 (closed) and in the corresponding ansi-test/ansi-test#39?

  • Carl Shapiro added 3 commits

    added 3 commits

    Compare with previous version

  • Carl Shapiro added 1 commit

    added 1 commit

    Compare with previous version

  • Carl Shapiro added 1 commit

    added 1 commit

    Compare with previous version

  • Carl Shapiro resolved all threads

    resolved all threads

  • Raymond Toy approved this merge request

    approved this merge request

  • merged

  • Carl Shapiro mentioned in commit 310e41eb

    mentioned in commit 310e41eb

  • Thank you for the detailed investigation. I copied this change for Clozure CL. https://github.com/Clozure/ccl/issues/445

  • Please register or sign in to reply
    Loading