Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recursiveMap(_:) #185

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Add recursiveMap(_:) #185

wants to merge 17 commits into from

Conversation

SusanDoggie
Copy link

@SusanDoggie SusanDoggie commented Mar 27, 2022

add recursiveMap() method.

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

@SusanDoggie SusanDoggie marked this pull request as ready for review March 28, 2022 03:32
@SusanDoggie SusanDoggie changed the title add recursiveMap() add recursiveMap(_:) Mar 28, 2022
@SusanDoggie SusanDoggie changed the title add recursiveMap(_:) [DNM] add recursiveMap(_:) Mar 28, 2022
@SusanDoggie SusanDoggie changed the title [DNM] add recursiveMap(_:) Add recursiveMap(_:) Mar 28, 2022
@CTMacUser
Copy link
Contributor

Is a "recursive mapped sequence" a term of art for a particular structure? I've never heard of it before, and the documentation so far assumes you pretty much already know. A quick web search found something related using the Python language; is the code here supposed to be a Swift adaptation of the Python code?

The concept seems to be a way to do tree traversal without that type having to provide its own depth- and breath-first iterators; you just have to supply a function to map an element to a Sequence of its children, and this function takes care of the rest.

@SusanDoggie
Copy link
Author

Is a "recursive mapped sequence" a term of art for a particular structure? I've never heard of it before, and the documentation so far assumes you pretty much already know. A quick web search found something related using the Python language; is the code here supposed to be a Swift adaptation of the Python code?

The concept seems to be a way to do tree traversal without that type having to provide its own depth- and breath-first iterators; you just have to supply a function to map an element to a Sequence of its children, and this function takes care of the rest.

This method is simplified recursive CTE, which can map a hierarchical table to a linear sequence.

I don’t known what’s the name of this operation. So I call it recursive map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants