DEV Community

Discussion on: Grokking Traversable

Collapse
 
ducaale profile image
Mohamed Dahir

Wonderful post just like the rest of the series.

I think I have noticed a small error in the first code snippet after An Applicative clean up 🧽 which uses sequence instead of invert

let rec invert list =
    // An alias for :: so we can pass it as a function below
    let cons head tail = head :: tail

    match list with
    | head :: tail -> Some cons |> apply head |> apply (sequence tail)
    | [] -> Some []
Enter fullscreen mode Exit fullscreen mode
Collapse
 
choc13 profile image
Matt Thornton

Thanks for pointing that out. You’re right. And thanks for the kind words.

Collapse
 
choc13 profile image
Matt Thornton

Fixed πŸ”¨πŸ‘