Initial documentation cleanup with focus on utils.

This commit is contained in:
Dominik Pantůček 2023-04-08 22:23:42 +02:00
parent 55df1f2bed
commit 9e1291216d
3 changed files with 75 additions and 51 deletions

View file

@ -1170,36 +1170,6 @@ exception. An exception is raised if no exception was raised during
the evaluation. If the test passes, prints "." like all tests from the evaluation. If the test passes, prints "." like all tests from
this module do. this module do.
### Utils
To ensure there are no external dependencies (including chicken eggs),
this module re-implements any basic procedures which are required for
any algorithms used.
(filter pred? lst)
* ```pred?``` - procedure accepting any value and returning #t or #f
* ```lst``` - list to be filtered
Returns a list containing only elements matching given ```pred?```
predicate.
(string-repeat str rep)
* ```str``` - string to repeat
* ```rep``` - number of repeats
Returns a string created by repeating the string ```str``` exactly
```rep``` number of times.
(string-first+rest str)
* ```str``` - a string to split
Returns a pair of strings where the ```car``` of the pair is the first
token in the ```str``` given and ```cdr``` is a string with the
remainder with leading whitespace removed.
### Table ### Table
This module provides moderately complex terminal table rendering. This module provides moderately complex terminal table rendering.
@ -1261,25 +1231,4 @@ bottom table border.
The resulting list of strings is joined with newline character as the The resulting list of strings is joined with newline character as the
separator. separator.
### CSV Simple
This module provides a very simple, incomplete and incorrect but fast
CSV loader.
(csv-parse filename
[#:separator #\;]
[#:string-delimiter #\"])
* ```separator``` - cell separator in CSV file
* ```string-delimiter``` - for introducing strings possibly with separators
Parses given CSV file and returns list of lists of strings
representing its contents.
(csv-split-header csv)
* ```csv``` - list of lists of strings
Splits given loaded CSV into two tables at the first empty row.
### Environment ### Environment

75
doc/utils.md Normal file
View file

@ -0,0 +1,75 @@
Utility Modules
===============
To ensure there are no external dependencies (including chicken eggs),
these modules re-implement any basic procedures which are required for
any algorithms used. And some advanced yet generic functionality as
well.
The modules are listed in alphabetical order.
### CSV
This module provides a very simple, incomplete and incorrect but fast
CSV loader.
(csv-parse filename
[#:separator #\;]
[#:string-delimiter #\"])
* ```separator``` - cell separator in CSV file
* ```string-delimiter``` - for introducing strings possibly with separators
Parses given CSV file and returns list of lists of strings
representing its contents.
(csv-split-header csv)
* ```csv``` - list of lists of strings
Splits given loaded CSV into two tables at the first empty row.
### IO
### List
(import util-list)
This module implements basic list functionality which is common in
most scheme implementations.
(filter pred? lst)
* ```pred?``` - procedure accepting any value and returning #t or #f
* ```lst``` - list to be filtered
Returns a list containing only elements matching given ```pred?```
predicate.
### Set (List)
### String
(import util-string)
String manipulation functions which are used throughout other modules.
(string-repeat str rep)
* ```str``` - string to repeat
* ```rep``` - number of repeats
Returns a string created by repeating the string ```str``` exactly
```rep``` number of times.
(string-first+rest str)
* ```str``` - a string to split
Returns a pair of strings where the ```car``` of the pair is the first
token in the ```str``` given and ```cdr``` is a string with the
remainder with leading whitespace removed.
### Tag
### Time