hubFS: THE place for F#

. . . are you on The Hub?
Welcome to hubFS: THE place for F# Sign in | Join | Help
in Search

fold_left and fold_right signature

Last post 09-01-2008, 11:22 by yashez. 0 replies.
Sort Posts: Previous Next
  •  09-01-2008, 11:22 6798

    fold_left and fold_right signature

    Why do List.fold_left and List.fold_right have different signatures?

    List.fold_left
    ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a

    List.fold_right
    ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b

    With fold_left I can use something like this:
    let x = list |> List.fold_left (+) 0

    But I can't with fold_right.
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems