>>>>> mfv  <[email protected]> writes:

[…]

 > ;; 2) store as evaluated code/data ("Joe Jackson" ("person" "X" "Y")
 > (1 728 2812) ("[email protected]") ("S street" "T Town" "C Country"))

 > Again, I am not sure how the actual implentation of writing data
 > would be.

        It could be as simple as calling (write DATA).  Consider, e. g.:

- (define a '(jrh 42 (13 . 37)))
; no values returned
- (begin (write a) (newline))
(jrh 42 (13 . 37))

 > As for reading, I would read the parse the text file (e. g. by
 > reading \n separated string entries) and assign the text directly to
 > a code structure.

        It’s possible to simply (set! *database* (read)), provided that
        *database* was written with (write *database*).

 > This would happen a la (define somedata (<read-in-data>)) – or make
 > hash-tables out of them, etc.

 > ;; 3) store as text to be parsed by a parser "Joe Jackson" "person"
 > "X" "Y" 1 728 2812 "[email protected]" "S street" "T Town" "C Country"

 > The least practical solution, as it requires to write a parser.

        To note is that there’re existent parsers for a number of
        text-based data formats, such as XML, JSON, YAML, etc.

---
jrh:
  - 42
  - { car: 13; cdr: 37; }

[…]

-- 
FSF associate member #7257

_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to