DEV Community

Discussion on: Daily Challenge #298 - Find the Shortest Word

Collapse
 
aminnairi profile image
Amin

Elm

import String exposing (words, length)
import List exposing (foldl)


shortestLength : String -> Length
shortestLength text =
    text
        |> words
        |> foldl (\a b -> if length a < length b then a else b) text
        |> length
Enter fullscreen mode Exit fullscreen mode