[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Store data as text in scm files
From: |
mfv |
Subject: |
[Chicken-users] Store data as text in scm files |
Date: |
Fri, 27 Dec 2013 14:40:15 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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 "address@hidden") ; 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) ("address@hidden") ("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
"address@hidden"
"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] Store data as text in scm files,
mfv <=