thread safe functions
Is there somewhere a list of guile functions that are (/are not) thread safe ? I ask since this morning I was after a strange bug because I was using the format module in two different thread, then learnt that these functions are not reentrant. I'm also interrested in the thread-safeness of gc-stats function. And in general I think this info would be good to have for every functions.
Data Dictionary and Configuration Files with Guile Scheme
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
Re: Data Dictionary and Configuration Files with Guile Scheme
I would use records instead of lists. I think you can also make the input much simpler, for instance it might look like this: (define-table projects (integer id primary-key) (string name non-null #:length 32)) On Thu, Aug 5, 2010 at 12:15 PM, Romel Sandoval wrote: > 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 > > > > >