guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GUILE] Clubie question re loading data.


From: Bobby D. Bryant
Subject: [GUILE] Clubie question re loading data.
Date: Thu, 25 Jan 2001 14:43:50 -0600

I would like to store application configuration data as a Scheme list
and load it into my program at run time.  The best I can figure out so
far is to create a .scm file something like this...

;; Configuration data:
(define program-data
    '((size 100 100)
      (color blue)
      (more stuff like that below)
     )
)

...and then have my program load the file and examine the value of
program-data.

I would find it much more elegant to have the file like this...

;; Configuration data:
(program-data
   (size 100 100)
   (color blue)
   (more stuff like that below)
)

...and a mechanism to load the file into my program as quoted data.
Something like load, except that it returned the un-interpreted value of
the contents of the file, and bound it to whatever symbol you wanted to
use.  Then you could processes it at your leisure.

Granted, the difference is mostly cosmetic, though in the first case the
program has to have prior knowledge of the name program-data or it will
never find what you loaded.

Is there a straightforward way to do this from the high-level library?
It would be nice to have something like...

    SCM gh_quote_file(char *fname)

...that parallels...

    SCM gh_eval_file(char *fname)

...except returns the contents of the file as an unintepreted object
rather than evaluating the contents of the file and returning
#<unspecified>.

Thanks,

Bobby Bryant
Austin, Texas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]