-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
54 lines (44 loc) · 816 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
guile-csv
=========
Guile csv reader
## USAGE
### install
sudo make install
### read csv
```scheme
(use-modules (csv csv))
(define my-csv-reader (make-csv-reader #:\,))
(call-with-input-file "file.csv" my-csv-reader)
```
### csv->xml
```scheme
(call-with-input-file "file.csv" csv->xml)
```
and result could be:
```xml
<record-0>
<name>aaa</name>
<age>11</age>
<email>[email protected]</email>
</record-0>
<record-1>
<name>bbb</name>
<age>12</age>
<email>[email protected]</email>
</record-1>
```
### sxml->csv or csv-write to output a csv format file
```scheme
(call-with-output-file "file.csv"
(lambda (port)
(sxml->csv
'((name age email) ("aaa" "11" "[email protected]") ("bbb" "12" "[email protected]"))
port)))
```
and file.csv would be:
```csv
name,age,email
aaa,11,[email protected]
bbb,12,[email protected]
```
Enjoy!