I was refactoring some code and noted that some coders used Array.replicate and other Array.create when initializing an array with repeatedly the same value. The signatures of both functions are identical:
> Array.create;;
val it : (int -> 'a -> 'a [])
> Array.replicate;;
val it : (int -> 'a -> 'a [])
I also noted that both raise an ArgumentException on a negative count value, and both allow a count of zero. My gut tells me they are synonymous, but then I found this quote on F# For Fun And Profit:
Array.create is basically the same as replicate (although with a subtly different implementation!) but replicate was only implemented for Array in F# v4.
Is anybody aware of what differences exist, or are they, for all intents and purposes, aliases of one another (perhaps replicate was merely added for parity with seq)?