Is there a way to create a polymorphic add function in OCaml that works equally well for ints and floats? So for example if I have a function like:
partialsums [1; 2; 3; 4; 5]
I should get [1; 3; 6; 10; 15]
but this function won't work on [1.; 2.; 3.; 4.; 5.]
because in OCaml ints and floats absolutely cannot be mixed. But what if I want my function to work equally well for int lists and float lists? Is there a general type of which int and float are sub-types? If so, what is it? I'm a little lost on this one. Thanks for the help?