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

Support for index of element in a list in .traverse method #14

Closed
Vikasg7 opened this issue Mar 28, 2018 · 3 comments · May be fixed by #17
Closed

Support for index of element in a list in .traverse method #14

Vikasg7 opened this issue Mar 28, 2018 · 3 comments · May be fixed by #17

Comments

@Vikasg7
Copy link

Vikasg7 commented Mar 28, 2018

Hello @DrBoolean,
I am a new-comer to FP and have watched all your videos to be able to start using it.
So currently we don't have access to index of element in List().traverse() method. Can you add it?

Basically, from
List([1,2]).traverse(Task.of, (ele) => Task.of(ele))
to
List([1,2]).traverse(Task.of, (ele, index) => Task.of(ele))

workaround for now (but it may not be ideal for each situation):
List([1,2]).toMap().traverse(Task.of, (ele, index) => Task.of(ele))
So index becomes the key if we use toMap()

Also, you can take a look at other methods to make sure we have access to the index, if possible.

I hope it is something that is easy for you to implement.

StevenLangbroek added a commit to StevenLangbroek/immutable-ext that referenced this issue Feb 10, 2019
@StevenLangbroek
Copy link

@Vikasg7 I've started implementing. As you can see the actual code change is minimal.

@Vikasg7
Copy link
Author

Vikasg7 commented Feb 11, 2019

@StevenLangbroek Thanks, I used RXJS instead of Task.

@Vikasg7 Vikasg7 closed this as completed Feb 11, 2019
@StevenLangbroek
Copy link

@DrBoolean do you still want this change?

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 a pull request may close this issue.

2 participants