Core.Operators Module (F#)
Basic F# Operators. This module is automatically opened in all F# code.
Namespace/Module Path: Microsoft.FSharp.Core
Assembly: FSharp.Core (in FSharp.Core.dll)
[<AutoOpen>]
module Operators
Remarks
For an overview of operators in F#, see Symbol and Operator Reference (F#).
Modules
Module |
Description |
---|---|
module Checked |
This module contains the basic arithmetic operations with overflow checks. |
module OperatorIntrinsics |
A module of compiler intrinsic functions for efficient implementations of F# integer ranges and dynamic invocations of other F# operators |
module Unchecked |
This module contains basic operations which do not apply runtime and/or static checks |
Values
Value |
Description |
---|---|
( ! ) : 'T ref -> 'T |
Dereference a mutable reference cell. |
( % ) : ^T1 -> ^T2 -> ^T3 |
Overloaded modulo operator. |
( &&& ) : ^T -> ^T -> ^T |
Overloaded bitwise AND operator. |
( * ) : ^T1 -> ^T2 -> ^T3 |
Overloaded multiplication operator. |
( ** ) : ^T -> ^U -> ^T |
Overloaded exponentiation operator. |
( + ) : ^T1 -> ^T2 -> ^T3 |
Overloaded addition operator. |
( - ) : ^T1 -> ^T2 -> ^T3 |
Overloaded subtraction operator. |
( .. ) : ^T -> ^T -> seq<^T> |
The standard overloaded range operator, e.g. [n..m] for lists, seq {n..m} for sequences. |
( .. .. ) : ^T -> ^Step -> ^T -> seq<^T> |
The standard overloaded skip range operator, e.g. [n..skip..m] for lists, seq {n..skip..m} for sequences. |
( / ) : ^T1 -> ^T2 -> ^T3 |
Overloaded division operator. |
( := ) : 'T ref -> 'T -> unit |
Assigns to a mutable reference cell. |
( < ) : 'T -> 'T -> bool |
Structural less-than comparison. |
( << ) : ('T2 -> 'T3) -> ('T1 -> 'T2) -> 'T1 -> 'T3 |
Composes two functions, the function on the right being applied first. |
( <<< ) : ^T -> int32 -> ^T |
Overloaded byte-shift left operator by a specified number of bits. |
( <= ) : 'T -> 'T -> bool |
Structural less-than-or-equal comparison. |
( <> ) : 'T -> 'T -> bool |
Structural inequality. |
( <| ) : ('T -> 'U) -> 'T -> 'U |
Apply a function to a value, the value being on the right, the function on the left. |
( <|| ) : ('T1 -> 'T2 -> 'U) -> 'T1 * 'T2 -> 'U |
Apply a function to two values, the values being a pair on the right, the function on the left. |
( <||| ) : ('T1 -> 'T2 -> 'T3 -> 'U) -> 'T1 * 'T2 * 'T3 -> 'U |
Apply a function to three values, the values being a triple on the right, the function on the left. |
( = ) : 'T -> 'T -> bool |
Structural equality. |
( > ) : 'T -> 'T -> bool |
Structural greater-than. |
( >= ) : 'T -> 'T -> bool |
Structural greater-than-or-equal. |
( >> ) : ('T1 -> 'T2) -> ('T2 -> 'T3) -> 'T1 -> 'T3 |
Compose two functions, the function on the left being applied first. |
( >>> ) : ^T -> int32 -> ^T |
Overloaded byte-shift right operator by a specified number of bits. |
( @ ) : 'T list -> 'T list -> 'T list |
Concatenates two lists. |
( ^ ) : string -> string -> string |
Concatenates two strings. The operator '+' may also be used. |
( ^^^ ) : ^T -> ^T -> ^T |
Overloaded bitwise XOR operator. |
( |> ) : 'T1 -> ('T1 -> 'U) -> 'U |
Apply a function to a value, the value being on the left, the function on the right. |
( ||> ) : 'T1 * 'T2 -> ('T1 -> 'T2 -> 'U) -> 'U |
Apply a function to two values, the values being a pair on the left, the function on the right. |
( ||| ) : ^T -> ^T -> ^T |
Overloaded bitwise OR operator |
( |||> ) : 'T1 * 'T2 * 'T3 -> ('T1 -> 'T2 -> 'T3 -> 'U) -> 'U |
Apply a function to three values, the values being a triple on the left, the function on the right. |
( ~+ ) : ^T -> ^T |
Overloaded prefix plus operator. |
( ~- ) : ^T -> ^T |
Overloaded unary negation. |
( ~~~ ) : ^T -> ^T |
Overloaded bitwise NOT operator. |
abs : ^T -> ^T |
Absolute value of the given number. |
acos : ^T -> ^T |
Inverse cosine of the given number. |
asin : ^T -> ^T |
Inverse sine of the given number. |
atan : ^T -> ^T |
Inverse tangent of the given number. |
atan2 : ^T1 -> ^T2 -> 'T2 |
Inverse tangent of x/y where x and y are specified separately. |
box : 'T -> obj |
Boxes a strongly typed value. |
byte : ^T -> byte |
Converts the argument to byte. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
ceil : ^T -> ^T |
Ceiling of the given number. |
char : ^T -> char |
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. |
compare : 'T -> 'T -> int |
Generic comparison. |
cos : ^T -> ^T |
Cosine of the given number. |
cosh : ^T -> ^T |
Hyperbolic cosine of the given number. |
decimal : ^T -> decimal |
Converts the argument to Decimal using a direct conversion for all primitive numeric types. For strings, the input is converted using Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
decr : int ref -> unit |
Decrement a mutable reference cell containing an integer. |
defaultArg : 'T option -> 'T -> 'T |
Used to specify a default value for an optional argument in the implementation of a function. |
enum : int32 -> ^U |
Converts the argument to a particular enum type. |
exit : int -> 'T |
Exit the current hardware isolated process, if security settings permit, otherwise raise an exception. Calls Exit. |
exp : ^T -> ^T |
Exponential of the given number. |
Failure : string -> exn |
Builds a Exception object. |
failwith : string -> 'T |
Throw a Exception exception. |
float : ^T -> float |
Converts the argument to 64-bit float. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
float32 : ^T -> float32 |
Converts the argument to 32-bit float. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
floor : ^T -> ^T |
Floor of the given number. |
fst : 'T1 * 'T2 -> 'T1 |
Return the first element of a tuple, fst (a,b) = a. |
hash : 'T -> int |
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 behavior of the function can be adjusted on a type-by-type basis by implementing GetHashCode for each type. |
id : 'T -> 'T |
The identity function. |
ignore : 'T -> unit |
Ignore the passed value. This is often used to throw away results of a computation. |
incr : int ref -> unit |
Increment a mutable reference cell containing an integer. |
infinity : float |
Equivalent to PositiveInfinity. |
infinityf : float32 |
Equivalent to PositiveInfinity. |
int : ^T -> int |
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 Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
int16 : ^T -> int16 |
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 Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
int32 : ^T -> int32 |
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 Parse) with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
int64 : ^T -> int64 |
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 Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
invalidArg : string -> string -> 'T |
Throw a ArgumentException exception. |
invalidOp : string -> 'T |
Throw a InvalidOperationException exception. |
limitedHash : int -> 'T -> int |
A generic hash function. This function has the same behavior 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 behavior of the function can be adjusted on a type-by-type basis by implementing GetHashCode for each type. |
lock : 'Lock -> (unit -> 'T) -> 'T |
Execute the function as a mutual-exclusion region using the input value as a lock. |
log : ^T -> ^T |
Natural logarithm of the given number. |
log10 : ^T -> ^T |
Logarithm to base 10 of the given number. |
max : 'T -> 'T -> 'T |
Maximum based on generic comparison. |
min : 'T -> 'T -> 'T |
Minimum based on generic comparison. |
nan : float |
Equivalent to NaN. |
nanf : float32 |
Equivalent to NaN. |
nativeint : ^T -> nativeint |
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. |
not : bool -> bool |
Negate a logical value. |
nullArg : string -> 'T |
Throw an ArgumentNullException exception. |
pown : ^T -> int -> ^T |
Overloaded power operator. If n > 0 then equivalent to x*...*x for n occurrences of x. |
raise : Exception -> 'T |
Raises an exception. |
ref : 'T -> 'T ref |
Create a mutable reference cell. |
reraise : unit -> 'T |
Rethrows an exception. This should only be used when handling an exception. |
round : ^T -> ^T |
Round the given number. |
sbyte : ^T -> sbyte |
Converts the argument to signed byte. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
seq : seq<'T> -> seq<'T> |
Builds a sequence using sequence expression syntax. |
sign : ^T -> int |
Sign of the given number. |
sin : ^T -> ^T |
Sine of the given number. |
sinh : ^T -> ^T |
Hyperbolic sine of the given number. |
sizeof : int |
Returns the internal size of a type in bytes. For example, sizeof<int> returns 4. |
snd : 'T1 * 'T2 -> 'T2 |
Return the second element of a tuple, snd (a,b) = b. |
sqrt : ^T -> ^T |
Square root of the given number. |
stderr : TextWriter |
Reads the value of the property Error. |
stdin : TextReader |
Reads the value of the property In. |
stdout : TextWriter |
Reads the value of the property Out. |
string : ^T -> string |
Converts the argument to a string using ToString. |
tan : ^T -> ^T |
Tangent of the given number. |
tanh : ^T -> ^T |
Hyperbolic tangent of the given number. |
truncate : ^T -> ^T |
Overloaded truncate operator. |
typedefof : Type |
Generate a 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. |
typeof : Type |
Generate a Type runtime representation of a static type. The static type is still maintained on the value returned. |
uint16 : ^T -> uint16 |
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 Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
uint32 : ^T -> uint32 |
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 Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
uint64 : ^T -> uint64 |
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 Parse with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type. |
unativeint : ^T -> nativeint |
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. |
unbox : obj -> 'T |
Unboxes a strongly typed value. This is the inverse of box, unbox<'T>(box<'T> a) equals a. |
using : 'T -> ('T -> 'U) -> 'U |
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. |
Active Patterns
Active Pattern |
Description |
---|---|
( |Failure|_| ) : exn -> string option |
Matches Exception objects whose runtime type is precisely Exception. |
( |KeyValue| ) : KeyValuePair<'Key,'Value> -> 'Key * 'Value |
An active pattern to match values of type KeyValuePair<TKey, TValue> |
Platforms
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
Version Information
F# Core Library Versions
Supported in: 2.0, 4.0, Portable