unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* define - any name
@ 2003-04-19  7:22 Egil Moeller
  2003-04-20 14:58 ` Andreas Rottmann
  0 siblings, 1 reply; 11+ messages in thread
From: Egil Moeller @ 2003-04-19  7:22 UTC (permalink / raw)


At the moment, I have a function (list-entry type name), that given a
"type-definition" (a binary tree with names in), and a name, constructs a
function that will extract the entity at the position corresponding to
that name in the type, in a binary tree given as argument. The
"type-definition" i often constructed from other such definitions:

(define fride-vote-msg-type
  `(list
    (id:         ,fride-id-msg-type)
    (referendum: ,fride-id-reference-msg-type)
    (date:       int)
    (vote:       int)))

I use the list-entry function, then to construct a set of
"access-functions", e.g.

(define fride-vote-list.id (fride-list-entry fride-vote-msg-type 'id))
(define fride-vote-list.referendum (fride-list-entry fride-vote-msg-type 'referendum))

This is both quite some extra work, and also makes the code clumsier, than
if those functions could be automatically created. I'd like to write
something like

(define-type fride-vote-msg-type
  `(list
    (id:         ,fride-id-msg-type)
    (referendum: ,fride-id-reference-msg-type)
    (date:       int)
    (vote:       int)))

and have them all created. For this purpose I have created a function that
finds all names in a type-definition that can be used to create such
access-functions.

The question i, how do I go on from here? I'd like to make a macro, but
that would not let the backqoute be evaluated in the correct
environment... What I would need is a (define-unquoted-in-toplevel name
value), that would work like an ordinary funcion, evaluating its
arguments, and bind the value of name to the value of value, in the
top-level surrounding environment... Is this really not something people
have wanted before?

My idea about environments in quile is that they, due to speed
considerations or something, are a bit too limited... For example, an
eval-closure is _not_ an ordinary environment/can't be treated like one,
and one can not do (eval) with such an object as environment...

Regards,
Egil

-- 
http://redhog.org
GPG Public key: http://redhog.org/PGP%20Public%20key.asc
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <Pine.LNX.4.30.0304190908110.27066-100000@urd.norna.redhog. org>]

end of thread, other threads:[~2003-05-04 20:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-19  7:22 define - any name Egil Moeller
2003-04-20 14:58 ` Andreas Rottmann
2003-04-21 17:22   ` Egil Moeller
2003-04-21 23:46     ` dvanhorn
2003-04-26 11:10     ` Neil Jerram
2003-05-03 23:30       ` Marius Vollmer
2003-05-03 23:41     ` Marius Vollmer
2003-05-04 19:52       ` [ot] " rm
2003-05-04 20:24         ` Marius Vollmer
2003-05-04 20:18       ` Marius Vollmer
     [not found] <Pine.LNX.4.30.0304190908110.27066-100000@urd.norna.redhog. org>
2003-04-19 20:27 ` Ken Anderson

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).