BooleanCat / go-functional

go-functional is a library of iterators to augment the standard library
MIT License
405 stars 23 forks source link

Support Stringer for ChainIter and MapIter #92

Closed BooleanCat closed 8 months ago

BooleanCat commented 8 months ago

Please provide a brief description of the change.

Support Stringer representation for ChainIter and MapIter. This PR is a demonstration of the general pattern of string representations for Iterators that yield generic values (unlike Counter that always yields an int).

Which issue does this change relate to?

81

Contribution checklist.

BooleanCat commented 8 months ago

@myusko What do you think of this format for iterators that yield generic values?

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (b178f7a) 100.00% compared to head (90299ef) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #92 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 24 24 Lines 566 572 +6 ========================================= + Hits 566 572 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

BooleanCat commented 8 months ago

I'm not sure if I prefer Iterator<Map, type=string> or Iterator<Map, type=(int, string)>. Since the underlying iterator doesn't matter, perhaps the unput type for maps isn't important and I should only print the output type.

myusko commented 8 months ago

I'm not sure if I prefer Iterator<Map, type=string> or Iterator<Map, type=(int, string)>. Since the underlying iterator doesn't matter, perhaps the unput type for maps isn't important and I should only print the output type.

Yes, I support your idea, that it would be better to print the output format, e.g Iterator<Map, type=string> and I can beat that someone will be slightly confused with the Iterator<Map, type=(int, string)> format, someone will consider the Map as not a function that doing something with the input, but as a real hash table with (key, value) in our case (int, string)

🙂