From: Romel Sandoval <romel@lavabit.com>
To: guile-user@gnu.org
Subject: Data Dictionary and Configuration Files with Guile Scheme
Date: Thu, 05 Aug 2010 12:15:44 -0500 [thread overview]
Message-ID: <1281028544.2624.38.camel@romel-compaq> (raw)
Hi,
I'm trying to create a data dictionary [1] to generate code from it. But
since I'm a scheme newbie I was wondering if this is the best method:
{{{
(define-syntax table
(syntax-rules ()
((table name ...)
(list 'table name ...))))
(define-syntax column
(syntax-rules ()
((column name ...)
(list 'column name ...))))
(define-syntax type
(syntax-rules ()
((type symbol)
(cons 'type symbol))))
(define-syntax constraint
(syntax-rules ()
((constraint symbol)
(cons 'constraint symbol))))
(define-syntax length
(syntax-rules ()
((length value)
(cons 'length value))))
(define *projects-table*
(table "projects"
(column "id"
(type 'integer) (constraint 'primary-key))
(column "title"
(type 'string) (length 32) (constraint 'not-null))))
}}}
This way I can write s-exp as in the example *projects-table* an after a
load I will have the data structure ready to work with it.
{{{
scheme@(guile-user)> (load "dd.scm")
scheme@(guile-user)> *projects-table*
(table "projects" (column "id" (type . integer) (constraint .
primary-key)) (column "title" (type . string) (length . 32)
(constraint . not-null)))
}}}
I think this could be a good way to define configuration files too.
What do you think?
Exists better alternatives with Guile?
This mail should go to another list? :-)
Regards,
--
Romel R. Sandoval-Palomo
[1]http://database-programmer.blogspot.com/2008/06/using-data-dictionary.html
next reply other threads:[~2010-08-05 17:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 17:15 Romel Sandoval [this message]
2010-08-05 21:04 ` Data Dictionary and Configuration Files with Guile Scheme No Itisnt
2010-08-18 16:05 ` Andy Wingo
2010-08-18 17:38 ` Romel Sandoval
2010-08-18 18:20 ` Thien-Thi Nguyen
2010-08-20 14:10 ` Romel Sandoval
2010-08-20 14:39 ` Thien-Thi Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1281028544.2624.38.camel@romel-compaq \
--to=romel@lavabit.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).