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 Map function for Generator #45

Closed
elliot-u410 opened this issue Dec 20, 2022 · 3 comments
Closed

Add Map function for Generator #45

elliot-u410 opened this issue Dec 20, 2022 · 3 comments
Milestone

Comments

@elliot-u410
Copy link

Love this library! Thank you!

Right now if I want to map a function over a generator, I must use rapid.Custom. Would a simpler Map function be possible where it lets me simply define the translation between two types?

@flyingmutant
Copy link
Owner

Thanks for the kind words!

To map a function over a generator, you should use Transform. Before generics it was a method of the Generator called Map, but since methods can't be generic in Go, it became a top-level function (and was renamed to Transform to not be confused with the MapOf series of generators).

Maybe it is a good idea to rename Transform to Map, hmm.

@elliot-u410
Copy link
Author

Ah, I'm not sure how I missed that. As long as it exists, the name isn't as important to me. Thank you.

@flyingmutant
Copy link
Owner

(I'll leave this open for some time so that I don't forget about possible renaming).

@flyingmutant flyingmutant reopened this Dec 20, 2022
@flyingmutant flyingmutant added this to the rapid v1.0 milestone Dec 31, 2022
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

No branches or pull requests

2 participants