Skip to content

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

@Vikasg7

Description

@Vikasg7

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions