esemény
Intelligens alkalmazások létrehozása
márc. 17. 21 - márc. 21. 10
Csatlakozzon a meetup sorozathoz, hogy valós használati esetek alapján, skálázható AI-megoldásokat hozzon létre más fejlesztőkkel és szakértőkkel.
RegisztrációEzt a böngészőt már nem támogatjuk.
Frissítsen a Microsoft Edge-re, hogy kihasználhassa a legújabb funkciókat, a biztonsági frissítéseket és a technikai támogatást.
This article includes tables describing the symbols and operators that are used in F# and provides a brief description of each. Some symbols and operators have two or more entries when used in multiple roles.
The following table describes symbols related to comments, compiler directives and attributes.
Symbol or operator | Links | Description |
---|---|---|
(*...*) |
Delimits a comment that could span multiple lines. | |
// |
Indicates the beginning of a single-line comment. | |
/// |
XML Documentation | Indicates an XML comment. |
# |
Compiler Directives | Prefixes a preprocessor or compiler directive. |
[<...>] |
Attributes | Delimits an attribute. |
The following table describes symbols related to strings.
Symbol or operator | Links | Description |
---|---|---|
" |
Strings | Delimits a text string. |
@" |
Strings | Starts a verbatim text string, which may include backslashes and other characters. |
""" |
Strings | Delimits a triple-quoted text string, which may include backslashes, double quotation marks and other characters. |
$" |
Interpolated Strings | Starts an interpolated string. |
' |
Literals | Delimits a single-character literal. |
``...`` |
Delimits an identifier that would otherwise not be a legal identifier, such as a language keyword. | |
\ |
Strings | Escapes the next character; used in character and string literals. |
The following table describes the arithmetic operators.
Symbol or operator | Links | Description |
---|---|---|
+ |
Arithmetic Operators |
|
- |
Arithmetic Operators |
|
* |
Arithmetic Operators Tuples Units of Measure |
|
/ |
Arithmetic Operators Units of Measure |
|
% |
Arithmetic Operators | Computes the integer remainder. |
** |
Arithmetic Operators | Computes the exponentiation operation (x ** y means x to the power of y ). |
The following table describes the comparison operators.
Symbol or operator | Links | Description |
---|---|---|
< |
Arithmetic Operators | Computes the less-than operation. |
<> |
Arithmetic Operators | Returns true if the left side is not equal to the right side; otherwise, returns false. |
<= |
Arithmetic Operators | Returns true if the left side is less than or equal to the right side; otherwise, returns false . |
= |
Arithmetic Operators | Returns true if the left side is equal to the right side; otherwise, returns false . |
> |
Arithmetic Operators | Returns true if the left side is greater than the right side; otherwise, returns false . |
>= |
Arithmetic Operators | Returns true if the left side is greater than or equal to the right side; otherwise, returns false . |
The following table describes the arithmetic and boolean operators symbols.
Symbol or operator | Links | Description |
---|---|---|
&& |
Boolean Operators | Computes the Boolean AND operation. |
|| |
Boolean Operators | Computes the Boolean OR operation. |
The following table describes bitwise operators.
Symbol or operator | Links | Description |
---|---|---|
&&& |
Bitwise Operators | Computes the bitwise AND operation. |
<<< |
Bitwise Operators | Shifts bits in the quantity on the left side to the left by the number of bits specified on the right side. |
>>> |
Bitwise Operators | Shifts bits in the quantity on the left side to the right by the number of places specified on the right side. |
^^^ |
Bitwise Operators | Computes the bitwise exclusive OR operation. |
||| |
Bitwise Operators | Computes the bitwise OR operation. |
~~~ |
Bitwise Operators | Computes the bitwise NOT operation. |
The following table describes the operators and symbols related to functions.
Symbol or operator | Links | Description |
---|---|---|
-> |
Functions | In function expressions, separates the input pattern from the output expression. |
|> |
Functions | Passes the result of the left side to the function on the right side (forward pipe operator). |
||> |
( ||> )<'T1,'T2,'U> Function | Passes the tuple of two arguments on the left side to the function on the right side. |
|||> |
( |||> )<'T1,'T2,'T3,'U> Function | Passes the tuple of three arguments on the left side to the function on the right side. |
>> |
Functions | Composes two functions (forward composition operator). |
<< |
Functions | Composes two functions in reverse order; the second one is executed first (backward composition operator). |
<| |
Functions | Passes the result of the expression on the right side to the function on left side (backward pipe operator). |
<|| |
( <|| )<'T1,'T2,'U> Function | Passes the tuple of two arguments on the right side to the function on left side. |
<||| |
( <||| )<'T1,'T2,'T3,'U> Function | Passes the tuple of three arguments on the right side to the function on left side. |
The following table describes symbols related to type annotation and type tests.
Symbol or operator | Links | Description |
---|---|---|
-> |
Functions | In function types, delimits arguments and return values, also yields a result in sequence expressions. |
: |
Functions | In a type annotation, separates a parameter or member name from its type. |
:> |
Casting and Conversions | Converts a type to type that is higher in the hierarchy. |
:? |
Match Expressions | Returns true if the value matches the specified type (including if it is a subtype); otherwise, returns false (type test operator). |
:?> |
Casting and Conversions | Converts a type to a type that is lower in the hierarchy. |
# |
Flexible Types | When used with a type, indicates a flexible type, which refers to a type or any one of its derived types. |
' |
Automatic Generalization | Indicates a generic type parameter. |
<...> |
Automatic Generalization | Delimits type parameters. |
^ |
Statically Resolved Type Parameters Strings |
|
{} |
Class or Record | When used with the type keyword, delimits a class or record. The type is a class when members are declared or the class keyword is used. Otherwise, it's a record. |
{||} |
Anonymous record | Denotes an anonymous record |
The following table describes additional symbols used in member lookup and slice expressions.
Symbol or operator | Links | Description |
---|---|---|
. |
Members | Accesses a member, and separates individual names in a fully qualified name. |
[...] or .[...] |
Arrays Indexed Properties Slice Expressions |
Indexes into an array, string or collection, or takes a slice of a collection. |
The following table describes symbols related to tuples, lists, unit values and arrays.
Symbol or operator | Links | Description |
---|---|---|
( ) |
Unit Type | Represents the single value of the unit type. |
, |
Tuples | Separates the elements of a tuple, or type parameters. |
:: |
Lists Match Expressions |
|
@ |
Lists | Concatenates two lists. |
[...] |
Lists | Delimits the elements of a list. |
[|...|] |
Arrays | Delimits the elements of an array. |
The following table describes additional symbols used in expressions.
Symbol or operator | Links | Description |
---|---|---|
<- |
Values | Assigns a value to a variable. |
; |
Verbose Syntax |
Separates expressions (used mostly in verbose syntax). Also separates elements of a list or fields of a record. |
The following table describes additional symbols used in Sequences and Computation Expressions.
Symbol or operator | Links | Description |
---|---|---|
-> |
Sequences | Yields an expression (in sequence expressions); equivalent to the do yield keywords. |
! |
Computation Expressions | After a keyword, indicates a modified version of the keyword's behavior as controlled by a computation expression. |
The following table describes symbols related to pattern matching.
Symbol or operator | Links | Description |
---|---|---|
-> |
Match Expressions | Used in match expressions. |
& |
Pattern Matching |
|
_ |
Match Expressions Generics |
|
| |
Match Expressions | Delimits individual match cases, individual discriminated union cases, and enumeration values. |
The following table describes symbols related to declarations.
Symbol or operator | Links | Description |
---|---|---|
(|...|) |
Active Patterns | Delimits an active pattern name. Also called banana clips. |
? |
Parameters and Arguments | Specifies an optional argument. |
~~ |
Operator Overloading | Used to declare an overload for the unary negation operator. |
~- |
Operator Overloading | Used to declare an overload for the unary minus operator. |
~+ |
Operator Overloading | Used to declare an overload for the unary plus operator. |
The following table describes symbols related to Code Quotations.
Symbol or operator | Links | Description |
---|---|---|
<@...@> |
Code Quotations | Delimits a typed code quotation. |
<@@...@@> |
Code Quotations | Delimits an untyped code quotation. |
% |
Code Quotations | Used for splicing expressions into typed code quotations. |
%% |
Code Quotations | Used for splicing expressions into untyped code quotations. |
The following table describes additional symbols used in dynamic lookup expressions. They are not generally used in routine F# programming and no implementations of these operator are provided in the F# core library.
Symbol or operator | Links | Description |
---|---|---|
? |
Used as an operator for dynamic method and property calls. | |
? ... <- ... |
Used as an operator for setting dynamic properties. |
Nullable Operators are defined for use in Query Expressions. The following table shows these operators.
Symbol or operator | Links | Description |
---|---|---|
%? |
Nullable Operators | Computes the integer remainder, when the right side is a nullable type. |
*? |
Nullable Operators | Multiplies the left and right sides, when the right side is a nullable type. |
+? |
Nullable Operators | Adds the left and right sides, when the right side is a nullable type. |
-? |
Nullable Operators | Subtracts the right side from the left side, when the right side is a nullable type. |
/? |
Nullable Operators | Divides the left side by the right side, when the right side is a nullable type. |
<? |
Nullable Operators | Computes the less than operation, when the right side is a nullable type. |
<>? |
Nullable Operators | Computes the "not equal" operation when the right side is a nullable type. |
<=? |
Nullable Operators | Computes the "less than or equal to" operation when the right side is a nullable type. |
=? |
Nullable Operators | Computes the "equal" operation when the right side is a nullable type. |
>? |
Nullable Operators | Computes the "greater than" operation when the right side is a nullable type. |
>=? |
Nullable Operators | Computes the "greater than or equal" operation when the right side is a nullable type. |
?>= , ?> , ?<= , ?< , ?= , ?<> , ?+ , ?- , ?* , ?/ |
Nullable Operators | Equivalent to the corresponding operators without the ? prefix, where a nullable type is on the left. |
>=? , >? , <=? , <? , =? , <>? , +? , -? , *? , /? |
Nullable Operators | Equivalent to the corresponding operators without the ? suffix, where a nullable type is on the right. |
?>=? , ?>? , ?<=? , ?<? , ?=? , ?<>? , ?+? , ?-? , ?*? , ?/? |
Nullable Operators | Equivalent to the corresponding operators without the surrounding question marks, where both sides are nullable types. |
The following table describes symbols related to Reference Cells. The use of these operators generates advisory messages as of F# 6. For more information, see Reference cell operation advisory messages.
Symbol or operator | Links | Description |
---|---|---|
! |
Reference Cells | Dereferences a reference cell. |
:= |
Reference Cells | Assigns a value to a reference cell. |
The following table shows the order of precedence of operators and other expression keywords in F#, in order from lowest precedence to the highest precedence. Also listed is the associativity, if applicable.
Operator | Associativity |
---|---|
as |
Right |
when |
Right |
| (pipe) |
Left |
; |
Right |
let |
Nonassociative |
function , fun , match , try |
Nonassociative |
if |
Nonassociative |
not |
Right |
-> |
Right |
:= |
Right |
, |
Nonassociative |
or , || |
Left |
& , && |
Left |
:> , :?> |
Right |
< op, > op, = , | op, & op, & , $ (including <<< , >>> , ||| , &&& ) |
Left |
^ op(including ^^^ ) |
Right |
:: |
Right |
:? |
Not associative |
- op, + op |
Applies to infix uses of these symbols |
* op, / op, % op |
Left |
** op |
Right |
f x (function application)(including lazy x , assert x ) |
Left |
| (pattern match) |
Right |
prefix operators (+ op, - op, % , %% , & , && , ! op, ~ op) |
Left |
. |
Left |
f(x) |
Left |
f< types> |
Left |
F# supports custom operator overloading. This means that you can define your own operators. In the previous table, op can be any valid (possibly empty) sequence of operator characters, either built-in or user-defined. Thus, you can use this table to determine what sequence of characters to use for a custom operator to achieve the desired level of precedence. Leading .
characters are ignored when the compiler determines precedence.
.NET-visszajelzés
A(z) .NET egy nyílt forráskód projekt. Visszajelzés adásához válasszon egy hivatkozást:
esemény
Intelligens alkalmazások létrehozása
márc. 17. 21 - márc. 21. 10
Csatlakozzon a meetup sorozathoz, hogy valós használati esetek alapján, skálázható AI-megoldásokat hozzon létre más fejlesztőkkel és szakértőkkel.
Regisztráció