DEV Community

loading...

Discussion on: De-throning the List: Summary

Collapse
herteby profile image
Simon Herteby

Ah I see. Surely it'll be more efficient than people writing their own though. Here's mine πŸ˜…

remove : Int -> List a -> List a
remove index list =
    list
        |> List.indexedMap Tuple.pair
        |> List.filter (\( i, _ ) -> i /= index)
        |> List.map Tuple.second