[Top][All Lists]

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

Re: [Fwd: Req for help on objects and environments]

From: tomas
Subject: Re: [Fwd: Req for help on objects and environments]
Date: Thu, 2 Sep 2004 13:53:16 +0200
User-agent: Mutt/1.5.3i

On Thu, Sep 02, 2004 at 02:09:05PM +0300, Alp ?ztarhan wrote:
> Maybe I should give more information:
> 1) I work on gentoo linux guile 1.6.4
> 2) I try to program in Scheme. I DO NOT use C or C++ in my project.
>    Just pure Scheme.
> 3) I try to control the environment I "eval" my expression, but
>    manipulating the environment is not described in my documentation.
>    (which comes with guile-1.6.4)

AFAIK eval takes an expression and a module (which is an environment)
to eval the expression in. I don't quite understand your problem.
Could you give some examples?

> 4) I also want to use the (make-object-property) scheme procedure.
>    Unfortunately, I cannot list the properties of a given object.

Like this?

 | guile> (define x 42)
 | guile> (set-object-property! x 'colour 'green)
 | green
 | guile> (set-object-property! x 'size 42)
 | 42
 | guile> (set-object-property! x 'friends '(alfred bert carol))
 | (alfred bert carol)
 | guile> (object-properties x)
 | ((friends alfred bert carol) (size . 42) (colour . green))
 | guile> (object-property x 'friends)
 | (alfred bert carol)

(note that the object properties is an alist, the key being the car of the
sublists, the value the cdr. But you can (and usually should) ignore that
and use object-property, object-properties and so on).

(Note as well that the properties get attached to the *value*, not to the

 | guile> (object-property 42 'friends)
 | (alfred bert carol)

Does this help?

-- tomás

Attachment: pgpNNYe_zdMpt.pgp
Description: PGP signature

reply via email to

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