- The snippets are under the CC-BY-SA license.
- Please consider keeping a bookmark
- (instead of printing)
Caml | |||
---|---|---|---|
1 |
Print a literal string on standard output
|
||
2 |
Loop to execute some code a constant number of times
|
||
3 |
Like a function which doesn't return any value, thus has only side effects (e.g. Print to standard output)
|
||
4 |
Create a function which returns the square of an integer
|
||
5 |
Declare a container type for two floating-point numbers x and y
|
||
6 |
Do something with each item x of the list (or array) items, regardless indexes.
|
||
7 |
Print each index i with its value x from an array-like collection items
|
||
8 |
Create a new map object x, and provide some (key, value) pairs as initial content.
|
||
9 |
The structure must be recursive because left child and right child are binary trees too. A node has access to children nodes, but not to its parent.
|
||
12 |
Check if the list contains the value x.
list is an iterable finite container. |
||
17 |
The structure must be recursive. A node may have zero or more children. A node has access to its children nodes, but not to its parent.
|
||
19 |
Reverse the order of the elements of the list x.
This may reverse "in-place" and destroy the original ordering. |
||
20 |
Implement a function search which looks for item x in a 2D matrix m.
Return indices i, j of the matching cell. Think of the most idiomatic way in the language to return the two values at the same time. |
|
|
54 |
Calculate the sum s of the integer list or array x.
|
||
79 |
Declare the floating point number y and initialize it with the value of the integer x .
|
||
122 |
Create an enumerated type Suit with 4 possible values SPADES, HEARTS, DIAMONDS, CLUBS.
|
||
220 |
Create t consisting of 3 values having different types.
Explain if the elements of t are strongly typed or not. |
|