The "Unknown:"s below indicate that an entry is incomplete.
indentation | block (grouping statements, especially when statements are not expressions) |
nothing needed | breaking lines (useful when end-of-line and/or indentation has a special meaning) |
(* ... *) | commenting (nestable) |
// | commenting (until end of line) |
< > <= >= | comparison |
min / max | comparison (min / max (binary or more)) |
compare | comparison (returns 3 values (i.e. inferior, equal or superior)) |
(** ... *) | documentation comment (non nestable) |
/// | documentation comment (until end of line) |
= <> | equality / inequality (deep) |
== != | equality / inequality (shallow) |
System.GC.Collect() | force garbage collection |
( ... ) | grouping expressions |
begin ... end | grouping expressions |
__LINE__ __SOURCE_FILE__ | information about the current line and file |
case-sensitive | tokens (case-sensitivity (keywords, variable identifiers...)) |
[_a-zA-Z][_a-zA-Z0-9']* | tokens (variable identifier regexp) |
CamelCase for methods, types and modules, underscore for functions | tokens (what is the standard way for scrunching together multiple words) |
<- | variable assignment or declaration (assignment) |
let v = e in | variable assignment or declaration (declaration) |
let v = e(1) | variable assignment or declaration (declaration) |
(>) a | partial application (in the examples below, a normal call is "f(a,b)") (give the first argument to operator ">") |
f a | partial application (in the examples below, a normal call is "f(a,b)") (give the first argument) |
fun a b -> ... | anonymous function |
f a b ... | function call |
f() | function call (with no parameter) |
<< | function composition |
>> | function composition |
let f para1 para2 = ... | function definition |
no syntax needed(2) | function return value (function body is the result) |
try a with exn -> ... | exception (catching) |
finally | exception (cleanup: code executed before leaving) |
raise | exception (throwing) |
if c then ... | if_then |
if c then b1 else b2 | if_then_else |
for i = 10 downto 1 do ... done | loop (for each value in a numeric range, 1 decrement) |
for i in 10 .. -1 .. 1 do ... done | loop (for each value in a numeric range, 1 decrement) |
for i = 1 to 10 do ... done | loop (for each value in a numeric range, 1 increment (see also the entries about ranges)) |
for i in 1 .. 10 do ... done | loop (for each value in a numeric range, 1 increment (see also the entries about ranges)) |
for i in 1 .. 2 .. 10 do ... done | loop (for each value in a numeric range, free increment) |
while c do ... done | loop (while condition do something) |
while c do ... | loop (while condition do something) |
match val with | v1 -> ... | v2 | v3 -> ... | _ -> ... | multiple selection (switch) |
; | sequence |
end-of-line | sequence |
: | annotation (or variable declaration) |
t e | cast (computed conversion (calls an internal or a user-defined function)) |
e :?> t | cast (downcast (need runtime checking)) |
downcast e(3) | cast (downcast (need runtime checking)) |
e : t | cast (upcast) |
upcast e | cast (upcast) |
type n = t | declaration |
constness is the default | mutability, constness (type of a constant value) |
T ref | mutability, constness (type of a mutable value) |
type foo2 = inherit foo as parent ... member ... = ... parent.meth | accessing parent method |
type c() = class ... end | class declaration |
type c() = ... | class declaration |
the object variable | current instance |
GetType | get the type/class corresponding to an object/instance/value |
try obj.GetType().GetMethod("meth") with ... | has the method |
type child = inherit parent ... | inheritance |
Dispose | manually call an object's destructor |
object.method(para) | method invocation |
object.method | method invocation (with no parameter) |
o.GetType().GetMethods() | methods available |
new class_name(...) | object creation |
class_name(...) | object creation |
:? | testing class membership |
namespace p ... | declare |
namespace p val name1 : type1 ... | declare (selective export) |
open p | import (everything into current namespace) |
. | package scope |
s.[n] | accessing n-th character |
chr | ascii to character |
'z' | character "z" |
ord | character to ascii |
char | character type name |
ToString | convert something to a string (see also string interpolation) |
s.[n..m] | extract a substring |
sub | extract a substring |
IndexOf | locate a substring |
LastIndexOf | locate a substring (starting at the end) |
all strings allow multi-line strings | multi-line |
BinaryFormatter.Serialize | serialize (marshalling) |
print_any | simple print (on any objects) |
WriteLine | simple print (on any objects) |
print_string | simple print (on strings) |
printf | simple print (printf-like) |
sprintf | sprintf-like |
Format | sprintf-like |
+ | string concatenation |
^ | string concatenation |
= <> | string equality & inequality |
length | string size |
Length | string size |
"..." | strings (with no interpolation of variables) |
string | type name |
BinaryFormatter.Deserialize | unserialize (un-marshalling) |
uppercase / lowercase | upper / lower case character |
ToUpper / ToLower | upper / lower case character |
uppercase/lowercase | uppercase / lowercase / capitalized string |
ToUpper / ToLower | uppercase / lowercase / capitalized string |
Unknown:
strings (with interpolation of variables)
strings (end-of-line (without writing the real CR or LF character))
duplicate n times
false | false value |
not(4) | logical not |
|| / && | logical or / and (short circuit) |
true | true value |
bool | type name |
split | 2 lists from a list of couples |
unzip | 2 lists from a list of couples |
:: | adding an element at the beginning (list cons) (return the new list (no side-effect)) |
Tail | all but the first element |
tl | all but the first element |
fold | f(... f(f(init, e1), e2) ..., en) |
foldBack | f(e1, f(e2, ... f(en, init) ...)) |
find | find an element |
Head | first element |
hd | first element |
for v in l do ... | for each element do something |
iter | for each element do something |
l.Iterate(...) | for each element do something |
mem | is an element in the list |
exists | is the predicate true for an element |
for_all | is the predicate true for every element |
iteri | iterate with index |
IterateIndexed | iterate with index |
concat | join a list of strings in a string using a glue string |
find_all | keep elements (matching) |
filter | keep elements (matching) |
@ | list concatenation |
[ a ; b ; c ] | list constructor |
concat | list flattening (one level depth) |
flatten | list flattening (one level depth) |
combine | list of couples from 2 lists |
zip | list of couples from 2 lists |
length | list size |
Length | list size |
a.(i) | list/array indexing |
a.[i] | list/array indexing |
assoc | lookup an element in a association list |
partition | partition a list: elements matching, elements non matching |
rev | reverse |
sort(5) | sort |
map | transform a list (or bag) in another one |
Map | transform a list (or bag) in another one |
map2 | transform two lists in parallel |
a list | type name |
Unknown:
adding an element at index
adding an element at the end
last element
get the first element and remove it
get the last element and remove it
smallest / biggest element
remove duplicates
find | dictionary (access: read) |
h.[k] | dictionary (access: read/write) |
add, replace | dictionary (access: write) |
Map.of_list [a, b; c, d] | dictionary (constructor) |
Hashtbl.of_list [a, b; c, d] | dictionary (constructor) |
Contains | dictionary (has the key ?) |
mem | dictionary (has the key ?) |
remove | dictionary (remove by key) |
Remove | dictionary (remove by key) |
Map | dictionary (type name) |
Hashtbl | dictionary (type name) |
None | optional value (null value) |
option | optional value (type name) |
Some v | optional value (value) |
[ a .. b ] | range (inclusive .. inclusive) |
. | record (selector) |
:= | reference (pointer) (assigning (when dereferencing doesn't give a lvalue)) |
ref | reference (pointer) (creation) |
!(6) | reference (pointer) (dereference) |
a, b, c | tuple constructor |
typ1 * ... * typn | tuple type |
Unknown:
optional value (null coalescing)
record (type declaration)
union type declaration
enumerated type declaration
dictionary (merge)
+ / - / * / / | addition / subtraction / multiplication / division |
&&& / ||| / ^^^ | bitwise operators (and / or / xor) |
land / lor / lxor | bitwise operators (and / or / xor) |
~~~ | bitwise operators (bitwise inversion) |
lnot | bitwise operators (bitwise inversion) |
<<< / >>> | bitwise operators (left shift / right shift / unsigned right shift) |
lsl / lsr or asr | bitwise operators (left shift / right shift / unsigned right shift) |
** | exponentiation (power) |
log10 | logarithm (base 10) |
log | logarithm (base e) |
% | modulo (modulo of -3 / 2 is -1) |
mod | modulo (modulo of -3 / 2 is -1) |
- | negation |
1000., 1E3 | numbers syntax (floating point) |
0b1, 0o7, 0xf | numbers syntax (integers in base 2, octal and hexadecimal) |
1000 | numbers syntax (integers) |
mathematical | operator priorities and associativities (addition vs multiplication) |
negation first | operator priorities and associativities (exponentiation vs negation (is -3^2 equal to 9 or -9)) |
let r = System.Random() r.Next() | random (random number) |
sqrt / exp / abs | square root / e-exponential / absolute value |
sin / cos / tan | trigonometry (basic) |
asin / acos / atan(7) | trigonometry (inverse) |
int / / floor / ceil | truncate / round / floor / ceil |
int_of_float / / floor / ceil | truncate / round / floor / ceil |
float, float32 | type name (floating point) |
int, int8, uint8, int16, uint16, int32, uint32, int64, uint64, bigint, bignum | type name (integers) |
Unknown:
random (seed the pseudo random generator)