Hi all, the current ‘vector’ and ‘matrix’ functions in the F# extension modules take lists as input and create a DenseVector/DenseMatrix respectively. How about we change them to take sequences like so:

let inline vector (s: seq<'T>) = DenseVector.ofSeq s

and for matrix:

let inline matrix (s: seq<#seq<'T>>) = DenseMatrix.ofRowSeq s

F# takes sequence as anything that implements the IEnumerable interface, that includes lists, arrays, sequence expressions as well. So making the above changes will not affect existing functionality but then will open a lot more possibilities like the below:

This sounds like a very reasonable proposal. I agree that it would make it more flexible and usable in more scenarios. I do not remember why it has been typed for lists explicitly back then - maybe simply because that was the typical use case in interactive scripting.

It most probably will be a change in the binary level. But then I have tested it on my own project - I only needed to rebuild/relink with the new version and it did not break anything. Because anyone using the existing versions must be passing in a list for vector or a list of lists for matrix, which will work the same after the change. Its like like we are changing the function to take a superclass of list.

Am I getting you correctly or it is something else that is on your mind?

I propose I create a v4 branch. You can then send me the PR against this branch, instead of master.

We can do a jump to v4, but when we do this we should also clean up all the members marked as obsolete, and e.g. review the F# modules for other functionality where there would be better options but realizing them would be breaking.