Different argument order for getting N-th element of Array, List or Seq

后端 未结 3 523
野趣味
野趣味 2020-12-16 00:43

Is there a good reason for a different argument order in functions getting N-th element of Array, List or Seq:

Array.get source index
List .nth source index
         


        
3条回答
  •  鱼传尺愫
    2020-12-16 01:29

    Since Pad and bytebuster answered your last question I will focus on the why part.

    This is based my current knowledge and not historical facts.

    Since F# derived from OCaml and OCaml has Array and List but not Seq and F# uses |> for natural pipelining and type checking and OCaml lacks the pipleline operator, the authors of F# made the switch for Seq. But obviously to be backward compatablie with OCaml they did not switch everything.

提交回复
热议问题