hubFS: THE place for F#

. . . are you on The Hub?
Welcome to hubFS: THE place for F# Sign in | Join | Help
in Search

vector and DivideByInt

Last post 06-16-2009, 4:48 by DannyAsher. 0 replies.
Sort Posts: Previous Next
  •  06-16-2009, 4:48 10971

    vector and DivideByInt


    Hi,

    I was surprised to find that I was unable to Vector.average or Seq.average over vectors running into this error:

    Error: The type 'vector' does not support any operators named 'DivideByInt' 

    Attempting to add this using type extensions ran into the well-known operator limitation of type extensions (I'd love to see this fixed in the next Beta!!)

    type Microsoft.FSharp.Math.Vector<'a> with
        [<OverloadID("VectorFloat")>]
        static member DivideByInt (v:Vector<float>, i:int) = v * (1./ float i)



    Can anyone see a workaround?

    regards,

    Danny
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems