Skip to content

Adds mapWithIndex (map with a generated index) #68

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

Merged
merged 1 commit into from
Jul 26, 2016

Conversation

damncabbage
Copy link
Contributor

mapWithIndex :: forall a b. (Int -> a -> b) -> Array a -> Array b

This PR came about as a result of asking in the Gitter channel to see if anyone else writes their own version of this function: https://gitter.im/purescript/purescript?at=5785c87959cfbd4c5e93113f

(CC: @dkoontz, @felixSchl)

@damncabbage
Copy link
Contributor Author

(This is already called imap in the Haskell vector package, in case you're not happy with the name.)

@garyb
Copy link
Member

garyb commented Jul 21, 2016

mapWithIndex would be my preferred name 👍 we use imap for invariant functors: https://pursuit.purescript.org/packages/purescript-invariant/1.0.0/docs/Data.Functor.Invariant#v:imap

@paf31
Copy link
Contributor

paf31 commented Jul 25, 2016

Looks good! Agreed on the name.

@garyb garyb merged commit 90b1c3d into purescript:master Jul 26, 2016
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.

3 participants