Note that Vector itself still needs the rec keyword, so the static members can access the module level make function which is defined further down the file.
You might want to consider using type extensions to achieve this without the need for a forward reference:
a nested type can easily be made abstract via a signature file
Ah, that's interesting, but would prevent access to the individual X, Y, Z, W values of the vector as well, right? That seems like it would be too limiting in your case.
Here are some additional thoughts on your implementation:
[Matrix] is also based on Array2D so the code ended up quite imperative in places
You're referring to for loops that generate sequences? IMHO, this approach is actually quite elegant and fully consistent with functional programming, so I would hope you keep it. However, for clarity, I would change this:
ifabs(m1.[r,c]-m2.[r,c])>epsilonthenyieldfalse
To this:
yieldabs(m1.[r,c]-m2.[r,c])<=epsilon
You can also simplify this:
seq{// code}|>Seq.toArray
To this:
[|// code|]
I would also consider rewriting your final while loop to avoid the need for a mutable projectile. I suggest generating a sequence of immutable projectiles instead. Something like this:
I see. Thanks for the detailed response.
You might want to consider using type extensions to achieve this without the need for a forward reference:
Ah, that's interesting, but would prevent access to the individual X, Y, Z, W values of the vector as well, right? That seems like it would be too limiting in your case.
Here are some additional thoughts on your implementation:
You're referring to
for
loops that generate sequences? IMHO, this approach is actually quite elegant and fully consistent with functional programming, so I would hope you keep it. However, for clarity, I would change this:To this:
You can also simplify this:
To this:
I would also consider rewriting your final
while
loop to avoid the need for a mutableprojectile
. I suggest generating a sequence of immutable projectiles instead. Something like this:I hope this is helpful. Happy New Year!