From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Romel Sandoval Newsgroups: gmane.lisp.guile.user Subject: Data Dictionary and Configuration Files with Guile Scheme Date: Thu, 05 Aug 2010 12:15:44 -0500 Message-ID: <1281028544.2624.38.camel@romel-compaq> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1281028604 8986 80.91.229.12 (5 Aug 2010 17:16:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 5 Aug 2010 17:16:44 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Aug 05 19:16:41 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh43b-0004ze-Rp for guile-user@m.gmane.org; Thu, 05 Aug 2010 19:16:40 +0200 Original-Received: from localhost ([127.0.0.1]:44793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oh43a-0001U9-UH for guile-user@m.gmane.org; Thu, 05 Aug 2010 13:16:38 -0400 Original-Received: from [140.186.70.92] (port=55291 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oh42r-0001SZ-9d for guile-user@gnu.org; Thu, 05 Aug 2010 13:15:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oh42o-0006Dw-3u for guile-user@gnu.org; Thu, 05 Aug 2010 13:15:53 -0400 Original-Received: from karen.lavabit.com ([72.249.41.33]:34034) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh42n-0006DR-WA for guile-user@gnu.org; Thu, 05 Aug 2010 13:15:50 -0400 Original-Received: from d.earth.lavabit.com (d.earth.lavabit.com [192.168.111.13]) by karen.lavabit.com (Postfix) with ESMTP id 5AD6A11B845 for ; Thu, 5 Aug 2010 12:15:48 -0500 (CDT) Original-Received: from 148.209.128.70 (dsl-201-155-81-234-sta.prod-empresarial.com.mx [201.155.81.234]) by lavabit.com with ESMTP id 8MZ0QH3J9PIA for ; Thu, 05 Aug 2010 12:15:48 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=Zv4pEXzxzoYNjA/EnikJsBdoZNRuStUXPThfO2XkfFAYAH4MVWgDOj4O9wLfHy9dZ5gGGlUNTa4ejl6luQs7Zk8ODBeyv9ZwpWABNuQ5lqgXv9qqqmrPqz2AO9LLKvtXRC0eyZkkqvwjr+Jh1fSD/xR46JmUIN3DD7cwCrDzfdQ=; h=Subject:From:To:Content-Type:Date:Message-ID:Mime-Version:X-Mailer:Content-Transfer-Encoding; X-Mailer: Evolution 2.28.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8053 Archived-At: 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