[Top][All Lists]

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

Re: Using Guile in C for program startup config

From: Thien-Thi Nguyen
Subject: Re: Using Guile in C for program startup config
Date: Tue, 28 Aug 2001 11:40:13 -0700

   From: Luke Hammer <address@hidden>
   Date: Wed, 29 Aug 2001 00:39:32 +1000

   I would welcome anyone's comments/suggestions on this, and I would
   also welcome any tips regarding how to go the other way: how to write
   the information in a C data structure back to scheme code like the
   above, to be saved to a config file....

it's probably easiest (and most fun) to prototype in scheme.  since you
have to load the config file anyway, put some play procs at the start.
after you've refined them, translate them to C.  this will be easy once
you figure out what procs you need:

as for that, it looks like there are two factorizations possible:
iteration and grouping.  for the first, use `map', `for-each' or a
named-let construct.  for the latter, consider using a closure:

(define (in-group:num num)
  (lambda args (apply + num args)))

(define add-9 (in-group:num 9))

(add-9 10 11 12) => 42

if, on the other hand, you want to use `with-X' style macros, see for
example the guile distribution in file test-suite/lib.scm the macro

(i recommend trying the closure approach first.)


reply via email to

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