[plt-scheme] Need some advices for Database
Hi, here's the quick version;
write and read work, if you are happy to use hash tables for your data
;; save-hash-table : hash-table file ->
(define (save-dict dict file)
(print-hash-table #t)
(call-with-output-file file
(lambda (port)
(write dict port)) 'truncate/replace)
file)
;; load-hash-table : file -> hash-table
(define (load-dict file)
(call-with-input-file file
(lambda (port)
(read port)))
)
I think I've been nesting my hash tables with no problems. (ie a value
can be another hash-table)
I'm pretty sure you can use struct's in the same way.
(I can't make sense of your use of class%)
if you really want an xls compatible format, (or wish to use a rdbms),
there are libraries in planet that help see
http://planet.plt-scheme.org/ - eg csv.plt: Comma-Separated Value
(CSV) Utilities in Scheme
Cheers,
Stephen
On Wed, Mar 12, 2008 at 10:48 AM, Ziboon <ziboon at gmail.com> wrote:
> hi all,
>
> I'm
> I am beginning in scheme language, I try to create a small program, it's a agenda / contact, I want to save & load my data when I execute my prog.
>
> I need two advices :
>
> 1) what is the best way to make a simple database with scheme?
> I start to make class% and define link into different class.
>
> 2) But the real problem is how to load & save data (in xls for example) , what is the best simple method ?
>
> Maybe this way "(open-output-file filename)" ?
>
> thanks
>
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>
--
Cheers,
Stephen
--
Stephen De Gabrielle
s.degabrielle at ucl.ac.uk
Telephone +44 (0)20 7679 5242 (x45242)
Mobile 079 851 890 45
Project: Making Sense of Information (MaSI)
http://www.uclic.ucl.ac.uk/annb/MaSI.html
UCLIC: University College London Interaction Centre
http://www.uclic.ucl.ac.uk/
Remax House - 31/32 Alfred Place
London - WC1E 7DP