Hello,
I am not yet through with the many nice scheme lang sources - however, I am
a bit puzzled on what would be the best way to store data. At the moment, I
refrain from using a database such a sqlite. This also applies for
parsing/writing binary data, although that is on my to-do/to-learn list in the
future.
I have come up with a couple of solutions. It strikes me that it is really
elegant to have a language were code is data.
However, I am yet undecided what would be the best solution to follow.
So, the examples are:
;; 1) store as scheme code/data
(list
"Joe Jackson" ; id
(list "person" "X" "Y") ; some metadata
(list 1 728 2812) ; telepone number etc
(list "[email protected]") ; email
(list "S street" "T Town" "C Country") ; address data
)
But how to store data in such a way? By using a macro?
;; 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.
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. 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.
Could someone give some hints or point me to recources were I could read more
about this
subject.
Cheers!
mfv
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users