Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5929437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:25:17+00:00 2026-05-22T14:25:17+00:00

if I want to define a extension method for float array like standard deviation,

  • 0

if I want to define a extension method for float array like standard deviation, would it be better to use module extension on Array module or extension on type float[]?
like :

module Array =
   let std (arr: float[]) = ...

or

type float ``[]`` with 
    member this.std = ...

If I do type extension as the latter, would the std be only calculated once or every time it is used?

And, what is the right format for the latter, apprently type float ``[]`` with does not comile… thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:25:17+00:00Added an answer on May 22, 2026 at 2:25 pm

    In this case, you can’t define a type extension so the issue is moot – you must use an extension of the Array module. The reason that you can’t define a type extension is that in F#, type extensions must exactly mirror type definitions, so you can define a type extension on the generic 'a list type, for instance, but not on the constructed type string list. Similarly, you could define an extension method on the (simulated) generic array type

    'a ``[]``
    

    but not on the constructed array type

    float ``[]``
    

    This behavior is different than C#, where it is possible to write extension methods on constructed generic types.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

why defined extension method with UrlHelper don't added in Url. EXTENSIONMETHOD when i want
Basically I want to implement a simple Rails extension to define the seriousness of
I want to define something like this in php : $EL = \n<br />\n;
I want to define a class method that has access to a local variable.
I want to add a file type extension to the Open Dialog of Excel
is it possible to define an extension method that at the same time is
I want to create a extension class for the List type so users can
Title says it mostly. I want to add a simple extension method to the
I wrote an extension method which returns me 2-dimensional array of YUV values from
I want to define some member variable and some code just in Debug Mode,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.