Operators Module
Basic F# Operators. This module is automatically opened in all F# code.
Nested modules
Modules | Description |
Contains extension methods to allow the use of F# indexer notation with arrays. This module is automatically opened in all F# code. | |
This module contains the basic arithmetic operations with overflow checks. | |
A module of comparison and equality operators that are statically resolved, but which are not fully generic and do not make structural comparison. Opening this module may make code that relies on structural or generic comparison no longer compile. | |
A module of compiler intrinsic functions for efficient implementations of F# integer ranges and dynamic invocations of other F# operators | |
This module contains basic operations which do not apply runtime and/or static checks |
Functions and values
Function or value | Description |
Full Usage: x ** y Parameters:
^T - The input base. y : ^U - The input exponent. Returns: ^T The base raised to the exponent. Modifiers: inline Type parameters: ^T, ^U |
Overloaded power operator.
Example
|
Dereference a mutable reference cell
Example
val count: int ref Multiple items val ref: value: 'T -> 'T ref -------------------- type 'T ref = Ref<'T> property Ref.Value: int with get, set | |
Full Usage: x % y Parameters:
^T1 - The first parameter. y : ^T2 - The second parameter. Returns: ^T3 The result of the operation. Modifiers: inline Type parameters: ^T1, ^T2, ^T3 |
Overloaded modulo operator
Example
|
Full Usage: x &&& y Parameters:
^T - The first parameter. y : ^T - The second parameter. Returns: ^T The result of the operation. Modifiers: inline Type parameters: ^T |
Overloaded bitwise-AND operator
Example
val a: int val b: int val c: int Evaluates to 9 |
Full Usage: x * y Parameters:
^T1 - The first parameter. y : ^T2 - The second parameter. Returns: ^T3 The result of the operation. Modifiers: inline Type parameters: ^T1, ^T2, ^T3 |
Overloaded multiplication operator
Example
|
Full Usage: x + y Parameters:
^T1 - The first parameter. y : ^T2 - The second parameter. Returns: ^T3 The result of the operation. Modifiers: inline Type parameters: ^T1, ^T2, ^T3 |
Overloaded addition operator
Example
|
Full Usage: x - y Parameters:
^T1 - The first parameter. y : ^T2 - The second parameter. Returns: ^T3 The result of the operation. Modifiers: inline Type parameters: ^T1, ^T2, ^T3 |
Overloaded subtraction operator
Example
|
Full Usage: (....) start step finish Parameters:
^T - The start value of the range. step : ^Step - The step value of the range. finish : ^T - The end value of the range. Returns: ^T seq The sequence spanning the range using the specified step size. Modifiers: inline Type parameters: ^T, ^Step |
The standard overloaded skip range operator, e.g.
Example
|
Full Usage: (..) start finish Parameters:
^T - The start value of the range. finish : ^T - The end value of the range. Returns: ^T seq The sequence spanning the range. Modifiers: inline Type parameters: ^T |
The standard overloaded range operator, e.g.
Example
|
Full Usage: x / y Parameters:
^T1 - The first parameter. y : ^T2 - The second parameter. Returns: ^T3 The result of the operation. Modifiers: inline Type parameters: ^T1, ^T2, ^T3 |
Overloaded division operator
Example
|
Full Usage: cell := value Parameters:
'T ref - The cell to mutate. value : 'T - The value to set inside the cell. |
Assign to a mutable reference cell
Example
val count: int ref Multiple items val ref: value: 'T -> 'T ref -------------------- type 'T ref = Ref<'T> property Ref.Value: int with get, set |
Structural less-than comparison
Example
| |
Full Usage: func2 << func1 Parameters:
'T2 -> 'T3 - The second function to apply. func1 : 'T1 -> 'T2 - The first function to apply. Returns: 'T1 -> 'T3 The composition of the input functions. Modifiers: inline Type parameters: 'T2, 'T3, 'T1 |
Compose two functions, the function on the right being applied first
Example
val addOne: x: int -> int val x: int val doubleIt: x: int -> int val doubleThenAdd: (int -> int) |
Full Usage: value <<< shift Parameters:
^T - The input value. shift : int32 - The amount to shift. Returns: ^T The result of the operation. Modifiers: inline Type parameters: ^T |
Overloaded byte-shift left operator by a specified number of bits
Example
val a: int val c: int Evaluates to 208 |
Structural less-than-or-equal comparison
Example
| |
Structural inequality
Example
| |
Full Usage: func <| arg1 Parameters:
'T -> 'U - The function. arg1 : 'T - The argument. Returns: 'U The function result. Modifiers: inline Type parameters: 'T, 'U |
Apply a function to a value, the value being on the right, the function on the left
Example
val doubleIt: x: int -> int val x: int |
Full Usage: (<||) func (arg1, arg2) Parameters:
'T1 -> 'T2 -> 'U - The function. arg1 : 'T1 - The first argument. arg2 : 'T2 - The second argument. Returns: 'U The function result. Modifiers: inline Type parameters: 'T1, 'T2, 'U |
Apply a function to two values, the values being a pair on the right, the function on the left
Example
val sum: x: int -> y: int -> int val x: int val y: int |
Full Usage: (<|||) func (arg1, arg2, arg3) Parameters:
'T1 -> 'T2 -> 'T3 -> 'U - The function. arg1 : 'T1 - The first argument. arg2 : 'T2 - The second argument. arg3 : 'T3 - The third argument. Returns: 'U The function result. Modifiers: inline Type parameters: 'T1, 'T2, 'T3, 'U |
Apply a function to three values, the values being a triple on the right, the function on the left
Example
val sum3: x: int -> y: int -> z: int -> int val x: int val y: int val z: int |
Structural equality
Example
| |
Structural greater-than
Example
| |
Structural greater-than-or-equal
Example
| |
Full Usage: func1 >> func2 Parameters:
'T1 -> 'T2 - The first function to apply. func2 : 'T2 -> 'T3 - The second function to apply. Returns: 'T1 -> 'T3 The composition of the input functions. Modifiers: inline Type parameters: 'T1, 'T2, 'T3 |
Compose two functions, the function on the left being applied first
Example
val addOne: x: int -> int val x: int val doubleIt: x: int -> int val addThenDouble: (int -> int) |
Full Usage: value >>> shift Parameters:
^T - The input value. shift : int32 - The amount to shift. Returns: ^T The result of the operation. Modifiers: inline Type parameters: ^T |
Overloaded byte-shift right operator by a specified number of bits
Example
val a: int val c1: int val c2: int |
| |
Full Usage: x ^^^ y Parameters:
^T - The first parameter. y : ^T - The second parameter. Returns: ^T The result of the operation. Modifiers: inline Type parameters: ^T |
Overloaded bitwise-XOR operator
Example
val a: int val b: int val c: int Evaluates to 6 |
Full Usage: arg |> func Parameters:
'T1 - The argument. func : 'T1 -> 'U - The function. Returns: 'U The function result. Modifiers: inline Type parameters: 'T1, 'U |
Apply a function to a value, the value being on the left, the function on the right
Example
val doubleIt: x: int -> int val x: int |
Full Usage: (||>) (arg1, arg2) func Parameters:
'T1 - The first argument. arg2 : 'T2 - The second argument. func : 'T1 -> 'T2 -> 'U - The function. Returns: 'U The function result. Modifiers: inline Type parameters: 'T1, 'T2, 'U |
Apply a function to two values, the values being a pair on the left, the function on the right
Example
val sum: x: int -> y: int -> int val x: int val y: int |
Full Usage: x ||| y Parameters:
^T - The first parameter. y : ^T - The second parameter. Returns: ^T The result of the operation. Modifiers: inline Type parameters: ^T |
Overloaded bitwise-OR operator
Example
val a: int val b: int val c: int Evaluates to 15 |
Full Usage: (|||>) (arg1, arg2, arg3) func Parameters:
'T1 - The first argument. arg2 : 'T2 - The second argument. arg3 : 'T3 - The third argument. func : 'T1 -> 'T2 -> 'T3 -> 'U - The function. Returns: 'U The function result. Modifiers: inline Type parameters: 'T1, 'T2, 'T3, 'U |
Apply a function to three values, the values being a triple on the left, the function on the right
Example
val sum3: x: int -> y: int -> z: int -> int val x: int val y: int val z: int |
Full Usage: ~+value Parameters:
^T - The input value. Returns: ^T The result of the operation. Modifiers: inline Type parameters: ^T |
Overloaded prefix-plus operator
|
Full Usage: ~-n Parameters:
^T - The value to negate. Returns: ^T The result of the operation. Modifiers: inline Type parameters: ^T |
Overloaded unary negation.
|
Full Usage: ~~~value Parameters:
^T - The input value. Returns: ^T The result of the operation. Modifiers: inline Type parameters: ^T |
Overloaded bitwise-NOT operator
Example
val byte1: byte val byte2: int Evaluates to 195 |
|
Builds a Exception object.
Example
val throwException: unit -> bool val raise: exn: System.Exception -> 'T Multiple items val Failure: message: string -> exn -------------------- active recognizer Failure: exn -> string option |
|
Negate a logical value. Not True equals False and not False equals True
Example
val fileDoesNotExist: (string -> bool) namespace System namespace System.IO type File = static member AppendAllBytes: path: string * bytes: byte array -> unit + 1 overload static member AppendAllBytesAsync: path: string * bytes: byte array * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendAllLines: path: string * contents: IEnumerable<string> -> unit + 1 overload static member AppendAllLinesAsync: path: string * contents: IEnumerable<string> * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendAllText: path: string * contents: string -> unit + 3 overloads static member AppendAllTextAsync: path: string * contents: string * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 3 overloads static member AppendText: path: string -> StreamWriter static member Copy: sourceFileName: string * destFileName: string -> unit + 1 overload static member Create: path: string -> FileStream + 2 overloads static member CreateSymbolicLink: path: string * pathToTarget: string -> FileSystemInfo ... <summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary> System.IO.File.Exists(path: string) : bool |
Full Usage: abs value Parameters:
^T - The input value. Returns: ^T The absolute value of the input. Modifiers: inline Type parameters: ^T |
Absolute value of the given number.
Example
val abs: value: 'T -> 'T (requires member Abs) |
Full Usage: acos value Parameters:
^T - The input value. Returns: ^T The inverse cosine of the input. Modifiers: inline Type parameters: ^T |
Inverse cosine of the given number
Example
val angleFromAdjacent: adjacent: float -> hypotenuse: float -> float val adjacent: float val hypotenuse: float val acos: value: 'T -> 'T (requires member Acos) |
Full Usage: asin value Parameters:
^T - The input value. Returns: ^T The inverse sine of the input. Modifiers: inline Type parameters: ^T |
Inverse sine of the given number
Example
val angleFromOpposite: opposite: float -> hypotenuse: float -> float val opposite: float val hypotenuse: float val asin: value: 'T -> 'T (requires member Asin) |
Full Usage: atan value Parameters:
^T - The input value. Returns: ^T The inverse tangent of the input. Modifiers: inline Type parameters: ^T |
Inverse tangent of the given number
Example
val angleFrom: opposite: float -> adjacent: float -> float val opposite: float val adjacent: float val atan: value: 'T -> 'T (requires member Atan) |
Full Usage: atan2 y x Parameters:
^T1 - The y input value. x : ^T1 - The x input value. Returns: 'T2 The inverse tangent of the input ratio. Modifiers: inline Type parameters: ^T1, 'T2 |
Inverse tangent of
Example
val angleFromPlaneAtXY: x: float -> y: float -> float val x: float val y: float val atan2: y: 'T1 -> x: 'T1 -> 'T2 (requires member Atan2) namespace System type Math = static member Abs: value: decimal -> decimal + 7 overloads static member Acos: d: float -> float static member Acosh: d: float -> float static member Asin: d: float -> float static member Asinh: d: float -> float static member Atan: d: float -> float static member Atan2: y: float * x: float -> float static member Atanh: d: float -> float static member BigMul: a: int * b: int -> int64 + 5 overloads static member BitDecrement: x: float -> float ... <summary>Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.</summary> field System.Math.PI: float = 3.14159265359 |
Boxes a strongly typed value.
Example
val x: int Multiple items val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int val obj1: obj val box: value: 'T -> obj val unbox: value: obj -> 'T Multiple items val double: value: 'T -> double (requires member op_Explicit) -------------------- type double = System.Double -------------------- type double<'Measure> = float<'Measure> | |
Full Usage: byte value Parameters:
^T - The input value. Returns: byte The converted byte Modifiers: inline Type parameters: ^T |
Converts the argument to byte. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val byte: value: 'T -> byte (requires member op_Explicit) -------------------- type byte = System.Byte -------------------- type byte<'Measure> = byte |
Full Usage: ceil value Parameters:
^T - The input value. Returns: ^T The ceiling of the input. Modifiers: inline Type parameters: ^T |
Ceiling of the given number
Example
val ceil: value: 'T -> 'T (requires member Ceiling) |
Full Usage: char value Parameters:
^T - The input value. Returns: char The converted char. Modifiers: inline Type parameters: ^T |
Converts the argument to character. Numeric inputs are converted according to the UTF-16 encoding for characters. String inputs must be exactly one character long. For other input types the operation requires an appropriate static conversion method on the input type.
Example
Multiple items val char: value: 'T -> char (requires member op_Explicit) -------------------- type char = System.Char |
Full Usage: compare e1 e2 Parameters:
'T - The first value. e2 : 'T - The second value. Returns: int The result of the comparison. Modifiers: inline Type parameters: 'T |
Generic comparison.
Example
val compare: e1: 'T -> e2: 'T -> int (requires comparison) |
Full Usage: cos value Parameters:
^T - The input value. Returns: ^T The cosine of the input. Modifiers: inline Type parameters: ^T |
Cosine of the given number
Example
val cos: value: 'T -> 'T (requires member Cos) namespace System type Math = static member Abs: value: decimal -> decimal + 7 overloads static member Acos: d: float -> float static member Acosh: d: float -> float static member Asin: d: float -> float static member Asinh: d: float -> float static member Atan: d: float -> float static member Atan2: y: float * x: float -> float static member Atanh: d: float -> float static member BigMul: a: int * b: int -> int64 + 5 overloads static member BitDecrement: x: float -> float ... <summary>Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.</summary> field System.Math.PI: float = 3.14159265359 <summary>Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.</summary> |
Full Usage: cosh value Parameters:
^T - The input value. Returns: ^T The hyperbolic cosine of the input. Modifiers: inline Type parameters: ^T |
Hyperbolic cosine of the given number
Example
val cosh: value: 'T -> 'T (requires member Cosh) |
Full Usage: decimal value Parameters:
^T - The input value. Returns: decimal The converted decimal. Modifiers: inline Type parameters: ^T |
Converts the argument to System.Decimal using a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val decimal: value: 'T -> decimal (requires member op_Explicit) -------------------- type decimal = System.Decimal -------------------- type decimal<'Measure> = decimal |
Decrement a mutable reference cell containing an integer Example
val count: int ref Multiple items val ref: value: 'T -> 'T ref -------------------- type 'T ref = Ref<'T> val decr: cell: int ref -> unit property Ref.Value: int with get, set | |
Full Usage: defaultArg arg defaultValue Parameters:
'T option - An option representing the argument. defaultValue : 'T - The default value of the argument. Returns: 'T The argument value. If it is None, the defaultValue is returned. |
Used to specify a default value for an optional argument in the implementation of a function
Example
Multiple items type Vector = new: x: double * y: double * ?z: double -> Vector member X: double member Y: double member Z: double -------------------- new: x: double * y: double * ?z: double -> Vector val x: double Multiple items val double: value: 'T -> double (requires member op_Explicit) -------------------- type double = System.Double -------------------- type double<'Measure> = float<'Measure> val y: double val z: double option val z: double val defaultArg: arg: 'T option -> defaultValue: 'T -> 'T val this: Vector member Vector.X: double member Vector.Y: double member Vector.Z: double val v1: Vector property Vector.Z: double with get val v2: Vector |
Full Usage: defaultIfNull defaultValue arg Parameters:
'T - The default value of the argument. arg : 'T - A nullable value representing the argument. Returns: 'T The argument value. If it is null, the defaultValue is returned. Modifiers: inline Type parameters: 'T |
Used to specify a default value for a nullable reference argument in the implementation of a function
|
Full Usage: defaultIfNullV defaultValue arg Parameters:
'T - The default value of the argument. arg : Nullable<'T> - A nullable value representing the argument. Returns: 'T The argument value. If it is null, the defaultValue is returned. Modifiers: inline Type parameters: 'T |
Used to specify a default value for an nullable value argument in the implementation of a function
|
Full Usage: defaultValueArg arg defaultValue Parameters:
'T voption - A value option representing the argument. defaultValue : 'T - The default value of the argument. Returns: 'T The argument value. If it is None, the defaultValue is returned. |
Used to specify a default value for an optional argument in the implementation of a function
Example
val arg1: int voption union case ValueOption.ValueSome: 'T -> ValueOption<'T> val defaultValueArg: arg: 'T voption -> defaultValue: 'T -> 'T union case ValueOption.ValueNone: ValueOption<'T> |
Full Usage: enum value Parameters:
int32 - The input value. Returns: ^U The converted enum type. Modifiers: inline Type parameters: ^U |
Converts the argument to a particular enum type.
Example
[<Struct>] type Color = | Red = 1 | Green = 2 | Blue = 3 val c: Color val enum: value: int32 -> 'U (requires enum) |
Full Usage: exit exitcode Parameters:
int - The exit code to use. Returns: 'T Never returns. |
Exit the current hardware isolated process, if security settings permit, otherwise raise an exception. Calls Environment.Exit.
Example
Multiple items type EntryPointAttribute = inherit Attribute new: unit -> EntryPointAttribute -------------------- new: unit -> EntryPointAttribute val main: argv: string array -> int val argv: string array property System.Array.Length: int with get <summary>Gets the total number of elements in all the dimensions of the <see cref="T:System.Array" />.</summary> <exception cref="T:System.OverflowException">The array is multidimensional and contains more than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> elements.</exception> <returns>The total number of elements in all the dimensions of the <see cref="T:System.Array" />; zero if there are no elements in the array.</returns> val eprintfn: format: Printf.TextWriterFormat<'T> -> 'T val exit: exitcode: int -> 'T val printfn: format: Printf.TextWriterFormat<'T> -> 'T |
Full Usage: exp value Parameters:
^T - The input value. Returns: ^T The exponential of the input. Modifiers: inline Type parameters: ^T |
Exponential of the given number
Example
val exp: value: 'T -> 'T (requires member Exp) |
Full Usage: failwith message Parameters:
string - The exception message. Returns: 'T Never returns. Modifiers: inline Type parameters: 'T |
Throw a Exception exception.
Example
val failingFunction: unit -> bool val failwith: message: string -> 'T |
Full Usage: float value Parameters:
^T - The input value. Returns: float The converted float Modifiers: inline Type parameters: ^T |
Converts the argument to 64-bit float. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val float: value: 'T -> float (requires member op_Explicit) -------------------- type float = System.Double -------------------- type float<'Measure> = float |
Full Usage: float32 value Parameters:
^T - The input value. Returns: float32 The converted float32 Modifiers: inline Type parameters: ^T |
Converts the argument to 32-bit float. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val float32: value: 'T -> float32 (requires member op_Explicit) -------------------- type float32 = System.Single -------------------- type float32<'Measure> = float32 |
Full Usage: floor value Parameters:
^T - The input value. Returns: ^T The floor of the input. Modifiers: inline Type parameters: ^T |
Floor of the given number
Example
val floor: value: 'T -> 'T (requires member Floor) |
Full Usage: fst tuple Parameters:
'T1 * 'T2 - The input tuple. Returns: 'T1 The first value. Modifiers: inline Type parameters: 'T1, 'T2 |
Return the first element of a tuple,
Example
val fst: tuple: ('T1 * 'T2) -> 'T1 |
A generic hash function, designed to return equal hash values for items that are equal according to the "=" operator. By default it will use structural hashing for F# union, record and tuple types, hashing the complete contents of the type. The exact behaviour of the function can be adjusted on a type-by-type basis by implementing GetHashCode for each type.
Example
val hash: obj: 'T -> int (requires equality) | |
Full Usage: id x Parameters:
'T - The input value. Returns: 'T The same value. |
The identity function
Example
val id: x: 'T -> 'T |
Full Usage: ignore value Parameters:
'T - The value to ignore. Modifiers: inline Type parameters: 'T |
Ignore the passed value. This is often used to throw away results of a computation.
Example
val ignore: value: 'T -> unit |
Increment a mutable reference cell containing an integer Example
val count: int ref Multiple items val ref: value: 'T -> 'T ref -------------------- type 'T ref = Ref<'T> val incr: cell: int ref -> unit property Ref.Value: int with get, set | |
Equivalent to Double.PositiveInfinity
| |
Equivalent to Single.PositiveInfinity
| |
Converts the argument to signed 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int | |
Full Usage: int16 value Parameters:
^T - The input value. Returns: int16 The converted int16 Modifiers: inline Type parameters: ^T |
Converts the argument to signed 16-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val int16: value: 'T -> int16 (requires member op_Explicit) -------------------- type int16 = System.Int16 -------------------- type int16<'Measure> = int16 |
Full Usage: int32 value Parameters:
^T - The input value. Returns: int32 The converted int32 Modifiers: inline Type parameters: ^T |
Converts the argument to signed 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val int32: value: 'T -> int32 (requires member op_Explicit) -------------------- type int32 = System.Int32 -------------------- type int32<'Measure> = int<'Measure> |
Full Usage: int64 value Parameters:
^T - The input value. Returns: int64 The converted int64 Modifiers: inline Type parameters: ^T |
Converts the argument to signed 64-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val int64: value: 'T -> int64 (requires member op_Explicit) -------------------- type int64 = System.Int64 -------------------- type int64<'Measure> = int64 |
|
Throw a ArgumentException exception with the given argument name and message.
Example
val fullName: firstName: string -> lastName: string -> string val firstName: string val lastName: string module String from Microsoft.FSharp.Core val invalidArg: argumentName: string -> message: string -> 'T val nameof: 'T -> string Throws System.ArgumentException: First name can't be null or blank (Parameter 'firstName') |
Full Usage: invalidOp message Parameters:
string - The exception message. Returns: 'T The result value. Modifiers: inline Type parameters: 'T |
Throw a InvalidOperationException exception
Example
Multiple items type FileReader = new: fileName: string -> FileReader member Open: unit -> unit -------------------- new: fileName: string -> FileReader val fileName: string Multiple items val string: value: 'T -> string -------------------- type string = System.String val mutable isOpen: bool val this: FileReader val invalidOp: message: string -> 'T val reader: FileReader member FileReader.Open: unit -> unit |
Full Usage: isNull value Parameters:
'T - The value to check. Returns: bool True when value is null, false otherwise. Modifiers: inline Type parameters: 'T |
Determines whether the given value is null.
Example
val isNull: value: 'T -> bool (requires 'T: null) |
| |
|
A generic hash function. This function has the same behaviour as 'hash', however the default structural hashing for F# union, record and tuple types stops when the given limit of nodes is reached. The exact behaviour of the function can be adjusted on a type-by-type basis by implementing GetHashCode for each type.
|
Full Usage: lock lockObject action Parameters:
'Lock - The object to be locked. action : unit -> 'T - The action to perform during the lock. Returns: 'T The resulting value. Modifiers: inline Type parameters: 'Lock, 'T |
Execute the function as a mutual-exclusion region using the input value as a lock.
Example
namespace System namespace System.Linq Multiple items type TestCounter = new: unit -> TestCounter member IncrementWithLock: unit -> unit member IncrementWithoutLock: unit -> unit member Count: int A counter object, supporting unlocked and locked increment -------------------- new: unit -> TestCounter val mutable count: int val this: TestCounter val lock: lockObject: 'Lock -> action: (unit -> 'T) -> 'T (requires reference type) val counter: TestCounter Multiple items val seq: sequence: 'T seq -> 'T seq -------------------- type 'T seq = System.Collections.Generic.IEnumerable<'T> member TestCounter.IncrementWithoutLock: unit -> unit Increment the counter, unlocked property TestCounter.Count: int with get Get the count val counter2: TestCounter member TestCounter.IncrementWithLock: unit -> unit Increment the counter, locked |
Full Usage: log value Parameters:
^T - The input value. Returns: ^T The natural logarithm of the input. Modifiers: inline Type parameters: ^T |
Natural logarithm of the given number
Example
val logBase: baseNumber: float -> value: float -> float val baseNumber: float val value: float val log: value: 'T -> 'T (requires member Log) |
Full Usage: log10 value Parameters:
^T - The input value. Returns: ^T The logarithm to base 10 of the input. Modifiers: inline Type parameters: ^T |
Logarithm to base 10 of the given number
Example
val log10: value: 'T -> 'T (requires member Log10) |
Full Usage: max e1 e2 Parameters:
'T - The first value. e2 : 'T - The second value. Returns: 'T The maximum value. Modifiers: inline Type parameters: 'T |
Maximum based on generic comparison
Example
val max: e1: 'T -> e2: 'T -> 'T (requires comparison) |
|
An internal, library-only compiler intrinsic for compile-time generation of a RuntimeMethodHandle.
|
Full Usage: min e1 e2 Parameters:
'T - The first value. e2 : 'T - The second value. Returns: 'T The minimum value. Modifiers: inline Type parameters: 'T |
Minimum based on generic comparison
Example
val min: e1: 'T -> e2: 'T -> 'T (requires comparison) |
|
Returns the name of the given symbol.
Example
val myVariableName: string val nameof: 'T -> string |
Equivalent to Double.NaN
| |
Equivalent to Single.NaN
| |
Full Usage: nativeint value Parameters:
^T - The input value. Returns: nativeint The converted nativeint Modifiers: inline Type parameters: ^T |
Converts the argument to signed native integer. This is a direct conversion for all primitive numeric types. Otherwise the operation requires an appropriate static conversion method on the input type.
Example
Multiple items val nativeint: value: 'T -> nativeint (requires member op_Explicit) -------------------- type nativeint = System.IntPtr -------------------- type nativeint<'Measure> = nativeint |
Full Usage: nonNull value Parameters:
'T - The value to check. Returns: 'T The value when it is not null. If the value is null an exception is raised. Modifiers: inline Type parameters: 'T |
Asserts that the value is non-null.
|
Full Usage: nonNullV value Parameters:
Nullable<'T> - The value to check. Returns: 'T True when value is null, false otherwise. Modifiers: inline Type parameters: 'T |
Asserts that the value is non-null. In a future revision of nullness support this may be unified with 'nonNull'.
|
Full Usage: nullArg argumentName Parameters:
string - The argument name. Returns: 'T Never returns. Modifiers: inline Type parameters: 'T |
Throw a ArgumentNullException exception
Example
val fullName: firstName: string -> lastName: string -> string val firstName: string val lastName: string val isNull: value: 'T -> bool (requires 'T: null) val nullArg: argumentName: string -> 'T val nameof: 'T -> string |
Full Usage: nullArgCheck argumentName arg2 Parameters:
string - The argument name. arg1 : 'T Returns: 'T The result value. Modifiers: inline Type parameters: 'T |
Throw a
|
Get the null value for a value type. In a future revision of nullness support this may be unified with 'null'.
| |
Overloaded power operator. If
Example
val pown: x: 'T -> n: int -> 'T (requires member One and member ( * ) and member (/)) | |
Raises an exception
Example
namespace System namespace System.IO exception FileNotFoundException of string Multiple items val string: value: 'T -> string -------------------- type string = System.String val readFile: fileName: string -> string val fileName: string type File = static member AppendAllBytes: path: string * bytes: byte array -> unit + 1 overload static member AppendAllBytesAsync: path: string * bytes: byte array * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendAllLines: path: string * contents: IEnumerable<string> -> unit + 1 overload static member AppendAllLinesAsync: path: string * contents: IEnumerable<string> * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendAllText: path: string * contents: string -> unit + 3 overloads static member AppendAllTextAsync: path: string * contents: string * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 3 overloads static member AppendText: path: string -> StreamWriter static member Copy: sourceFileName: string * destFileName: string -> unit + 1 overload static member Create: path: string -> FileStream + 2 overloads static member CreateSymbolicLink: path: string * pathToTarget: string -> FileSystemInfo ... <summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary> File.Exists(path: string) : bool val raise: exn: System.Exception -> 'T File.ReadAllText(path: string) : string When executed, raises a File.ReadAllText(path: string, encoding: System.Text.Encoding) : string FileNotFoundException . | |
Create a mutable reference cell
Example
val count: int ref Multiple items val ref: value: 'T -> 'T ref -------------------- type 'T ref = Ref<'T> property Ref.Value: int with get, set | |
Full Usage: reraise () Parameters:
unit Returns: 'T The result value. Modifiers: inline Type parameters: 'T |
Rethrows an exception. This should only be used when handling an exception
Example
val readFile: fileName: string -> 'a val fileName: string Multiple items val string: value: 'T -> string -------------------- type string = System.String val ex: exn val eprintfn: format: Printf.TextWriterFormat<'T> -> 'T val reraise: unit -> 'T |
Full Usage: round value Parameters:
^T - The input value. Returns: ^T The nearest integer to the input value. Modifiers: inline Type parameters: ^T |
Round the given number
Example
val round: value: 'T -> 'T (requires member Round) |
Full Usage: sbyte value Parameters:
^T - The input value. Returns: sbyte The converted sbyte Modifiers: inline Type parameters: ^T |
Converts the argument to signed byte. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val sbyte: value: 'T -> sbyte (requires member op_Explicit) -------------------- type sbyte = System.SByte -------------------- type sbyte<'Measure> = sbyte |
| |
Full Usage: sign value Parameters:
^T - The input value. Returns: int -1, 0, or 1 depending on the sign of the input. Modifiers: inline Type parameters: ^T |
Sign of the given number
Example
val sign: value: 'T -> int (requires member Sign) |
Full Usage: sin value Parameters:
^T - The input value. Returns: ^T The sine of the input. Modifiers: inline Type parameters: ^T |
Sine of the given number
Example
val sin: value: 'T -> 'T (requires member Sin) namespace System type Math = static member Abs: value: decimal -> decimal + 7 overloads static member Acos: d: float -> float static member Acosh: d: float -> float static member Asin: d: float -> float static member Asinh: d: float -> float static member Atan: d: float -> float static member Atan2: y: float * x: float -> float static member Atanh: d: float -> float static member BigMul: a: int * b: int -> int64 + 5 overloads static member BitDecrement: x: float -> float ... <summary>Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.</summary> field System.Math.PI: float = 3.14159265359 <summary>Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.</summary> |
Full Usage: sinh value Parameters:
^T - The input value. Returns: ^T The hyperbolic sine of the input. Modifiers: inline Type parameters: ^T |
Hyperbolic sine of the given number
Example
val sinh: value: 'T -> 'T (requires member Sinh) |
Returns the internal size of a type in bytes. For example,
Example
val sizeof<'T> : int type bool = System.Boolean Multiple items val byte: value: 'T -> byte (requires member op_Explicit) -------------------- type byte = System.Byte -------------------- type byte<'Measure> = byte Multiple items val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int Multiple items val double: value: 'T -> double (requires member op_Explicit) -------------------- type double = System.Double -------------------- type double<'Measure> = float<'Measure> Multiple items val nativeint: value: 'T -> nativeint (requires member op_Explicit) -------------------- type nativeint = System.IntPtr -------------------- type nativeint<'Measure> = nativeint | |
Full Usage: snd tuple Parameters:
'T1 * 'T2 - The input tuple. Returns: 'T2 The second value. Modifiers: inline Type parameters: 'T1, 'T2 |
Return the second element of a tuple,
Example
val snd: tuple: ('T1 * 'T2) -> 'T2 |
Full Usage: sqrt value Parameters:
^T - The input value. Returns: ^U The square root of the input. Modifiers: inline Type parameters: ^T, ^U |
Square root of the given number
Example
val sqrt: value: 'T -> 'U (requires member Sqrt) |
|
Reads the value of the property Console.Error.
|
|
Reads the value of the property Console.In.
|
|
Reads the value of the property Console.Out.
|
Full Usage: string value Parameters:
'T - The input value. Returns: string The converted string. Modifiers: inline Type parameters: 'T |
Converts the argument to a string using For standard integer and floating point values and any type that implements
Example
Multiple items val string: value: 'T -> string -------------------- type string = System.String |
Full Usage: tan value Parameters:
^T - The input value. Returns: ^T The tangent of the input. Modifiers: inline Type parameters: ^T |
Tangent of the given number
Example
val tan: value: 'T -> 'T (requires member Tan) namespace System type Math = static member Abs: value: decimal -> decimal + 7 overloads static member Acos: d: float -> float static member Acosh: d: float -> float static member Asin: d: float -> float static member Asinh: d: float -> float static member Atan: d: float -> float static member Atan2: y: float * x: float -> float static member Atanh: d: float -> float static member BigMul: a: int * b: int -> int64 + 5 overloads static member BitDecrement: x: float -> float ... <summary>Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.</summary> field System.Math.PI: float = 3.14159265359 <summary>Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.</summary> |
Full Usage: tanh value Parameters:
^T - The input value. Returns: ^T The hyperbolic tangent of the input. Modifiers: inline Type parameters: ^T |
Hyperbolic tangent of the given number
Example
val tanh: value: 'T -> 'T (requires member Tanh) |
Full Usage: truncate value Parameters:
^T - The input value. Returns: ^T The truncated value. Modifiers: inline Type parameters: ^T |
Overloaded truncate operator.
Example
val truncate: value: 'T -> 'T (requires member Truncate) |
|
Try to unbox a strongly typed value.
Example
val x: int Multiple items val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int val obj1: obj val box: value: 'T -> obj val tryUnbox: value: obj -> 'T option Multiple items val double: value: 'T -> double (requires member op_Explicit) -------------------- type double = System.Double -------------------- type double<'Measure> = float<'Measure> |
Generate a System.Type representation for a type definition. If the input type is a generic type instantiation then return the generic type definition associated with all such instantiations.
Example
val typeof<'T> : System.Type Multiple items val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int type 'T list = List<'T> val typedefof<'T> : System.Type | |
Generate a System.Type runtime representation of a static type.
Example
val t: System.Type val typeof<'T> : System.Type Multiple items val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int property System.Type.FullName: string with get | |
Full Usage: uint value Parameters:
^T - The input value. Returns: uint The converted int Modifiers: inline Type parameters: ^T |
Converts the argument to an unsigned 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val uint: value: 'T -> uint (requires member op_Explicit) -------------------- type uint = uint32 -------------------- type uint<'Measure> = uint |
Full Usage: uint16 value Parameters:
^T - The input value. Returns: uint16 The converted uint16 Modifiers: inline Type parameters: ^T |
Converts the argument to unsigned 16-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val uint16: value: 'T -> uint16 (requires member op_Explicit) -------------------- type uint16 = System.UInt16 -------------------- type uint16<'Measure> = uint16 |
Full Usage: uint32 value Parameters:
^T - The input value. Returns: uint32 The converted uint32 Modifiers: inline Type parameters: ^T |
Converts the argument to unsigned 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val uint32: value: 'T -> uint32 (requires member op_Explicit) -------------------- type uint32 = System.UInt32 -------------------- type uint32<'Measure> = uint<'Measure> |
Full Usage: uint64 value Parameters:
^T - The input value. Returns: uint64 The converted uint64 Modifiers: inline Type parameters: ^T |
Converts the argument to unsigned 64-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using
Example
Multiple items val uint64: value: 'T -> uint64 (requires member op_Explicit) -------------------- type uint64 = System.UInt64 -------------------- type uint64<'Measure> = uint64 |
Full Usage: unativeint value Parameters:
^T - The input value. Returns: unativeint The converted unativeint Modifiers: inline Type parameters: ^T |
Converts the argument to unsigned native integer using a direct conversion for all primitive numeric types. Otherwise the operation requires an appropriate static conversion method on the input type.
Example
Multiple items val unativeint: value: 'T -> unativeint (requires member op_Explicit) -------------------- type unativeint = System.UIntPtr -------------------- type unativeint<'Measure> = unativeint |
Full Usage: unbox value Parameters:
objnull - The boxed value. Returns: 'T The unboxed result. Modifiers: inline Type parameters: 'T |
Unbox a strongly typed value.
Example
val x: int Multiple items val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int val obj1: obj val box: value: 'T -> obj val unbox: value: obj -> 'T Multiple items val double: value: 'T -> double (requires member op_Explicit) -------------------- type double = System.Double -------------------- type double<'Measure> = float<'Measure> |
Full Usage: using resource action Parameters:
'T - The resource to be disposed after action is called. action : 'T -> 'U - The action that accepts the resource. Returns: 'U The resulting value. |
Clean up resources associated with the input object after the completion of the given function. Cleanup occurs even when an exception is raised by the protected code.
ExampleThe following code appends 10 lines to test.txt, then closes the StreamWriter when finished.
namespace System namespace System.IO val using: resource: 'T -> action: ('T -> 'U) -> 'U (requires 'T :> System.IDisposable) type File = static member AppendAllBytes: path: string * bytes: byte array -> unit + 1 overload static member AppendAllBytesAsync: path: string * bytes: byte array * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendAllLines: path: string * contents: IEnumerable<string> -> unit + 1 overload static member AppendAllLinesAsync: path: string * contents: IEnumerable<string> * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendAllText: path: string * contents: string -> unit + 3 overloads static member AppendAllTextAsync: path: string * contents: string * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 3 overloads static member AppendText: path: string -> StreamWriter static member Copy: sourceFileName: string * destFileName: string -> unit + 1 overload static member Create: path: string -> FileStream + 2 overloads static member CreateSymbolicLink: path: string * pathToTarget: string -> FileSystemInfo ... <summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary> File.AppendText(path: string) : StreamWriter val writer: StreamWriter val i: int32 TextWriter.WriteLine() : unit (+0 other overloads) TextWriter.WriteLine(value: uint64) : unit (+0 other overloads) TextWriter.WriteLine(value: uint32) : unit (+0 other overloads) TextWriter.WriteLine(value: System.Text.StringBuilder) : unit (+0 other overloads) TextWriter.WriteLine(value: float32) : unit (+0 other overloads) TextWriter.WriteLine(value: obj) : unit (+0 other overloads) TextWriter.WriteLine(value: int64) : unit (+0 other overloads) TextWriter.WriteLine(value: int) : unit (+0 other overloads) TextWriter.WriteLine(value: float) : unit (+0 other overloads) TextWriter.WriteLine(value: decimal) : unit (+0 other overloads) |
Full Usage: withNull value Parameters:
'T - The non-nullable value. Returns: 'T The same value re-typed as a nullable reference type. Modifiers: inline Type parameters: 'T |
Re-types a value into a nullable reference type (|null)
|
Full Usage: withNullV value Parameters:
'T - The value to wrap. Returns: Nullable<'T> System.Nullable wrapper of the input argument. Modifiers: inline Type parameters: 'T |
Wraps a value type into System.Nullable In a future revision of nullness support this may be unified with 'withNull'.
|
Active patterns
Active pattern | Description |
| |
Full Usage: (|KeyValue|) keyValuePair Parameters:
KeyValuePair<'Key, 'Value> - The input key/value pair. Returns: 'Key * 'Value A tuple containing the key and value. |
An active pattern to match values of type KeyValuePair
Example
val kv: System.Collections.Generic.KeyValuePair<int,string> namespace System namespace System.Collections namespace System.Collections.Generic Multiple items [<Struct>] type KeyValuePair<'TKey,'TValue> = new: key: 'TKey * value: 'TValue -> unit member Deconstruct: key: byref<'TKey> * value: byref<'TValue> -> unit member ToString: unit -> string member Key: 'TKey member Value: 'TValue <summary>Defines a key/value pair that can be set or retrieved.</summary> <typeparam name="TKey">The type of the key.</typeparam> <typeparam name="TValue">The type of the value.</typeparam> -------------------- type KeyValuePair = static member Create<'TKey,'TValue> : key: 'TKey * value: 'TValue -> KeyValuePair<'TKey,'TValue> <summary>Creates instances of the <see cref="T:System.Collections.Generic.KeyValuePair`2" /> struct.</summary> -------------------- System.Collections.Generic.KeyValuePair () System.Collections.Generic.KeyValuePair(key: 'TKey, value: 'TValue) : System.Collections.Generic.KeyValuePair<'TKey,'TValue> active recognizer KeyValue: System.Collections.Generic.KeyValuePair<'Key,'Value> -> 'Key * 'Value val v: string val k: int |
Full Usage: (|NonNullQuickV|) value Parameters:
Nullable<'T> - The value to check. Returns: 'T The non-null value. Modifiers: inline Type parameters: 'T |
When used in a pattern checks the given value is not null. In a future revision of nullness support this may be unified with 'NonNullQuick'.
|
Full Usage: (|NonNullQuick|) value Parameters:
'T - The value to check. Returns: 'T The non-null value. Modifiers: inline Type parameters: 'T |
When used in a pattern checks the given value is not null.
|
| |
|