Using Core.Std.List.fold_left without label

前端 未结 2 1300
灰色年华
灰色年华 2021-01-21 08:07

I am experimenting with Core\'s List.fold_left.

# List.fold_left;;
- : \'a Core.Std.List.t -> init:\'b -> f:(\'b -> \'a -> \'b) -> \'         


        
2条回答
  •  离开以前
    2021-01-21 08:22

    @sepp2k's answer clearly explains what is happening here. Let me add one more thing.

    Simply, do NOT omit labels of labeled functions. They are there for purposes. I believe no one can handle label omittion always correctly. You should always turn the warning 6 on and make it an error:

    $ ocamlc -w +6 -warn-error +6 file.ml
    File "file.ml", line 2, characters 17-18:
    Warning 6: labels were omitted in the application of this function.
    File "file.ml", line 1:
    Error: Some fatal warnings were triggered (1 occurrences)
    

提交回复
热议问题