made examples/demos for vectors && files && lists | also fixed a bug with the vector and list size and popping, explained in the adjacent comment
This commit is contained in:
@@ -2,6 +2,12 @@
|
||||
|
||||
I got bored with having to use complicated checking and stuff when working with files and arrays in C, so I implemented a new `file_t` struct which can load the contents of a file into a dynamically allocated array (yes, there is an implementation of those here as well... (`vector_t` struct)). The struct also stores the number of lines the file has.
|
||||
|
||||
Also, I managed to come up with an implementation of a Python-like list (a vector of vectors of any type interpreted as just one vector). Quite handy, I'd say. The `list_t` struct is what you want to use when working with lists.
|
||||
|
||||
The difference between a `vector_t` and a `list_t` is that a vector can only be of one type, whereas a list can have values of any type inside it (in this context, any means types defined in this library and default types in C).
|
||||
|
||||
Examples of this work of art are in the `/examples/` directory of this repo.
|
||||
|
||||
## Files
|
||||
|
||||
#### What works so far:
|
||||
@@ -13,6 +19,12 @@ I got bored with having to use complicated checking and stuff when working with
|
||||
|
||||
1. File writing logic
|
||||
2. File appending logic
|
||||
3. Copy a file to another file
|
||||
4. Move a file to another file
|
||||
5. Rename a file
|
||||
6. Delete a file
|
||||
7. Empty a file
|
||||
8. Add line numbers at the beggining of each line in a file
|
||||
|
||||
+ You tell me
|
||||
|
||||
@@ -31,6 +43,7 @@ I got bored with having to use complicated checking and stuff when working with
|
||||
#### TODO:
|
||||
|
||||
1. Removing an element at a given index
|
||||
2. Vectors of lists
|
||||
|
||||
+ You tell me
|
||||
|
||||
@@ -47,10 +60,10 @@ I got bored with having to use complicated checking and stuff when working with
|
||||
|
||||
#### TODO:
|
||||
|
||||
+ Inserting at a given index
|
||||
+ Verify multi-dimensional lists working
|
||||
+ Get/set at a given index
|
||||
+ Remove at a given index
|
||||
1. Inserting at a given index
|
||||
2. Verify multi-dimensional lists working - lists of lists
|
||||
3. Get/set at a given index
|
||||
4. Remove at a given index
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user