Skip to content

Latest commit

 

History

History
102 lines (73 loc) · 6.25 KB

File metadata and controls

102 lines (73 loc) · 6.25 KB

QuickData.Numbers.FSharp

Contents

Overview

This QuickData.Numbers.FSharp package contains the QuickData.Numbers.FSharp namespace for F# developers which provides some types, modules, and their related functions for building and manipulating sequences of numbers.

For more information about the types, modules, and functions provided, links are provided below.

Note: You can use IntelliSense in your code editor to get more information about each type and function.

All of the sequences generated by the functions in this package are standard F# sequences, and all of the internal processing is done exclusively with standard F# sequences, so they give you all of the benefits of, and follow the same rules as, standard F# sequences.

Types And Modules

The types provided, with associated modules, are (in alphabetical order):

Type/Module Defines/Specifies
BellShape The shape of a bell curve
BellPosition The position of a bell curve
Boolean.Seq Ways to generate sequences of bool
GradientSegment A gradient segment
GradientOrientation The orientation of a gradient
GradientPattern A gradient pattern
NaturalVarianceDegree An amount of variance
Normal.Seq Ways to generate sequences of Normal
NormalEquation Equations to use when generating sequences of Normal
Variance.Seq Ways to generate sequences of Variance

Discriminated Union Identity Values

In all of the QuickData.FSharp packages, where a discriminated union exists to specify a parameter for a function, there often will be two functions related to that discriminated union which return an integer identity value from the union case - toInt - or return a union case from an integer identity value - fromInt.

These can be useful if you need to store a value in a data structure which does not cater for discriminated unions, e.g. in a file, in JSON, etc.

The toInt function will always return a valid identity value.

Notes:

  1. Where a fromInt function exists there often will be exception-free versions available.

  2. All valid identity values are in the range 100 to 999 (inclusive). Any value which has fewer, or more, than three words can be immediately identified as being invalid, but not all three-digit values are valid.

  3. While identity values are unique within a discriminated union, some identity values may be shared by cases in different discriminated unions but no functional equality or relationship between the two should be inferred. Identity values will not change unless specifically mentioned in the release notes.

The defaultCase value (where available) contains the default case for the discriminated union.

The allCases value (where available) contains a list of all of the cases for the discriminated union.

Exception-free Processing

In all of the QuickData.FSharp packages, some functions will raise an exception if the internal processing fails for some reason or if the input was not as expected.

Many of this type of function will also have alternative exception-free versions which do not raise an exception.

These alternative functions are:

  • <module-name>.FailSafe.<function-name> : Returns a default value, instead of raising an exception;
  • <module-name>.Option.<function-name> : Returns None instead of raising an exception, otherwise Some value;
  • <module-name>.Result.<function-name> : Returns Error <error-type> instead of raising an exception, otherwise Ok value.

In general, but not always (as documented elsewhere), if there is no exception-free version of a function then it can be assumed that the function will not raise an exception.

Issues, Questions, and Suggestions

You can visit the QuickData.FSharp GitHub repository to report issues, ask questions, or make suggestions. You can also read about the changes across different versions in the release notes there.

Dependencies

This package is dependent upon FSharp.Core which you will be using anyway, and the QuickData.Core.FSharp package which will normally be automatically installed if you install this package.

Usage

The types and functions in this package have been designed to be used only with F#.

However, they may also be usable with C# but this has not been tested, so use them with C# at your own risk.