Updated documentation
This commit is contained in:
@@ -11,7 +11,7 @@ the standard library. It currently features:
|
||||
|
||||
- [**Vector**](/docs/vector.md): a growable, contiguous array of homogenous generic data types;
|
||||
- [**Map**](/docs/map.md): an associative array that handles generic heterogenous data types;
|
||||
- [**BigInt**](/docs/bigint.md): a data type for arbitrary large integers.
|
||||
- [**BigInt**](/docs/bigint.md): a data type for arbitrary large integers.
|
||||
|
||||
## Usage
|
||||
At its simplest, you can use this library as follows:
|
||||
|
||||
@@ -46,7 +46,7 @@ The `BigInt` data structure supports the following methods:
|
||||
- `bigint_result_t bigint_destroy(number)`: delete the big number;
|
||||
- `bigint_result_t bigint_printf(format, ...)`: `printf` wrapper that introduces the `%B` placeholder to print big numbers. It supports variadic parameters.
|
||||
|
||||
As you can see by the previous function signatures, methods that operate on the
|
||||
As you can see from the previous function signatures, methods that operate on the
|
||||
`BigInt` data type return a custom type called `bigint_result_t` which is defined as
|
||||
follows:
|
||||
|
||||
@@ -80,7 +80,7 @@ by setting the `status` field and by providing a descriptive message on the `mes
|
||||
field. If the operation was successful (that is, `status == BIGINT_OK`), you can either
|
||||
move on with the rest of the program or read the returned value from the sum data type.
|
||||
Of course, you can choose to ignore the return value (if you're brave enough :D) as
|
||||
illustrated in the first part of the README.
|
||||
illustrated on the first part of the README.
|
||||
|
||||
The sum data type (i.e., the `value` union) defines four different variables. Each
|
||||
of them has an unique scope as described below:
|
||||
|
||||
@@ -5,7 +5,7 @@ aspects (internal design, memory layout, etc.) of the `Map` data structure.
|
||||
`Map` is an hash table that uses open addressing with linear probing for collision
|
||||
resolution and the [FNV-1a algorithm](https://en.wikipedia.org/wiki/Fowler–Noll–Vo_hash_function) as its hashing function. Resizing is performed
|
||||
automatically by doubling the capacity when the load factor exceeds 75%. Internally,
|
||||
this data structure is represented by the following two structures:
|
||||
this data structure is represented by the following two layouts:
|
||||
|
||||
```c
|
||||
typedef struct {
|
||||
@@ -46,7 +46,7 @@ The `Map` data structure supports the following methods:
|
||||
- `size_t map_size(map)`: returns map size (i.e., the number of elements);
|
||||
- `size_t map_capacity(map)`: returns map capacity (i.e., map total size).
|
||||
|
||||
As you can see by the previous function signatures, most methods that operate
|
||||
As you can see from the previous function signatures, most methods that operate
|
||||
on the `Map` data type return a custom type called `map_result_t` which is
|
||||
defined as follows:
|
||||
|
||||
@@ -73,4 +73,4 @@ Each method that returns such type indicates whether the operation was successfu
|
||||
the `status` field and by providing a descriptive message on the `message` field. If the operation was
|
||||
successful (that is, `status == MAP_OK`), you can either move on with the rest of the program or read
|
||||
the returned value from the sum data type. Of course, you can choose to ignore the return value (if you're brave enough :D) as illustrated
|
||||
in the first part of the README.
|
||||
on the first part of the README.
|
||||
|
||||
@@ -5,7 +5,7 @@ aspects (internal design, memory layout, etc.) of the `Vector` data structure.
|
||||
`Vector` is a dynamic array with generic data type support; this means that you can store
|
||||
any kind of homogenous value on this data structure. Resizing is performed automatically
|
||||
by increasing the capacity by 1.5 times when the array becomes full. Internally, this
|
||||
data structure is represented by the following structure:
|
||||
data structure is represented by the following layout:
|
||||
|
||||
```c
|
||||
typedef struct {
|
||||
@@ -39,7 +39,7 @@ At the time being, `Vector` supports the following methods:
|
||||
- `size_t vector_size(vector)`: return vector size (i.e., the number of elements);
|
||||
- `size_t vector_capacity(vector)`: return vector capacity (i.e., vector total size).
|
||||
|
||||
As you can see by the previous function signatures, most methods that operate
|
||||
As you can see from the previous function signatures, most methods that operate
|
||||
on the `Vector` data type return a custom type called `vector_result_t` which is
|
||||
defined as follows:
|
||||
|
||||
@@ -66,7 +66,7 @@ Each method that returns such type indicates whether the operation was successfu
|
||||
by setting the `status` field and by providing a descriptive message on the `message`
|
||||
field. If the operation was successful (that is, `status == VECTOR_OK`), you can either
|
||||
move on with the rest of the program or read the returned value from the sum data type. Of course, you can choose to
|
||||
ignore the return value (if you're brave enough :D) as illustrated in the first part of the README.
|
||||
ignore the return value (if you're brave enough :D) as illustrated on the first part of the README.
|
||||
|
||||
## Functional methods
|
||||
`Vector` provides three functional methods called `map`, `filter` and `reduce` which allow the caller to apply a computation to the vector,
|
||||
|
||||
Reference in New Issue
Block a user