- The snippets are under the CC-BY-SA license.
- Please consider keeping a bookmark
- (instead of printing)
| Caml | |||
|---|---|---|---|
| 1 |
Class Def:
creates a new subclass called SudokuSolver with board as a declared variable, as well as the package it will be under. |
||
| 2 |
This method sets the internal board to the given 2D array aBoard.
|
||
| 3 |
Returns the value at a specific cell. Smalltalk arrays are 1-indexed, so we add 1 to both row and col.
|
||
| 4 |
Creates a copy of the board. Sets the value at the specified cell. Returns the new board (does not mutate the original).
|
||
| 5 |
Checks if num is already present in the specified row
|
||
| 6 |
Iterates over all rows in the column. Returns true if num is found.
|
||
| 7 |
Calculates the top-left corner of the 3×3 box. Iterates through all 9 cells in the box. Returns true if num is found.
|
||
| 8 |
Combines the three checks. Returns true if num is not in the row, column, or box.
|
||
| 9 |
Scans the board linearly (0 to 80). Converts each index to (row, col) using integer division and modulo.Returns the first cell with value 0 (empty), or nil if none found.
|
||
| 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. |
|