Skip to content

Added scan() #14

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added scan() #14

wants to merge 1 commit into from

Conversation

414owen
Copy link

@414owen 414owen commented Mar 30, 2019

Scanning is like reducing but keeping the intermediate accumulator states, haskell docs

@colbyr
Copy link
Contributor

colbyr commented May 6, 2019

Hey @414owen sorry I took so long getting back to you here. This looks pretty useful!

My question for you is can scan be implemented in terms of one of the existing protocols? It seems to me that you might be able to use _map (since the length of the input is the same as the length of the output) or failing that _reduce, but I definitely haven't through all the semantics.

The benefit of using an existing protocol is that if a project depends on transmute and has implemented the TransmuteCollection protocols for any project-specific types, they'll be able to use scan with those types without doing any extra work. If we add a new scan protocol, they'll have to implement it for their types before they can use it.

For examples of using the existing protocols, see pluck, which uses _map, and merge, which uses _reduce and _set. Anything of the functions in src/internal are fair game.

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