Reduce List to longest String in the List with Elm

Viewed 443

I'm trying to figure out how to create a function that takes a List of Strings and returns a new list that only contains the longest string in the list.

I'm having a hard time figuring out several aspects of this problem including how to keep track of the maximum and change it when there is a new longest string. Do I need to use an Effect / Task?

Example: a function that takes ["one", "two", "three"] and returns ["three"] since it is the longest string.

3 Answers
Related