From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alp =?ISO-8859-1?Q?=D6ztarhan?= Newsgroups: gmane.lisp.guile.user Subject: Re: [Fwd: Req for help on objects and environments] Date: Thu, 02 Sep 2004 15:47:46 +0300 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <1094129266.4098.25.camel@kuzgun> References: <1094123345.4412.5.camel@kuzgun> <20040902115316.GB30187@www> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1094129517 31332 80.91.224.253 (2 Sep 2004 12:51:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 2 Sep 2004 12:51:57 +0000 (UTC) Cc: tomas@fabula.de Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Sep 02 14:51:51 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C2r4B-0004wd-00 for ; Thu, 02 Sep 2004 14:51:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C2r99-0002gk-Iz for guile-user@m.gmane.org; Thu, 02 Sep 2004 08:56:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C2r8R-0002GM-Ts for guile-user@gnu.org; Thu, 02 Sep 2004 08:56:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C2r8L-0002DL-Qv for guile-user@gnu.org; Thu, 02 Sep 2004 08:56:10 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C2r8L-0002B4-53 for guile-user@gnu.org; Thu, 02 Sep 2004 08:56:09 -0400 Original-Received: from [193.140.74.28] (helo=uludag.org.tr) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1C2qxP-0004Ei-8Z for guile-user@gnu.org; Thu, 02 Sep 2004 08:44:52 -0400 Original-Received: from [10.1.5.88] (unknown [193.140.74.2]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by uludag.org.tr (Postfix) with ESMTP id AC19D53C066; Thu, 2 Sep 2004 16:04:20 +0300 (EEST) Original-To: guile-user@gnu.org In-Reply-To: <20040902115316.GB30187@www> X-Mailer: Ximian Evolution 1.4.6 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: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:3425 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:3425 Thank you very much for caring to write. But I still do not have the answers yet. On Thu, 2004-09-02 at 14:53, tomas@fabula.de wrote: > 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? The question about environments is this: I have an alist that contains my "variables". Say '((a . 3) (b . 5)). T want to be able to "eval" an expression, say '(+ a b), in an environment where a has value 3, b has value 5. For that, I have to manipulate an environment (null-environment maybe?) and put a and b as variables, with values 3 and 5 respectively. How can I manipulate the environment? Second, how do I get a null-environment? (Or any environment I can manipulate) It is in R5RS, but guile initially does not have it. I suspect it may be in an ice-9 module, but how can I find out which one? (Or maybe in SLIB?) How do I find out which variables an environment contains. Maybe I should ask: what is an "environment"? It is _not_ an alist. How can I play with it? > > 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 > *variable*): > > | guile> (object-property 42 'friends) > | (alfred bert carol) > > Does this help? Well, in a way it does. But the documentation says that this way of giving properties is "the old way". They say "the new way" is using (make-object-property). It seems nicer at least: |guile> (define var 'value) |guile> (define color (make-object-property)) |guile> (set! (color var) 'green) |guile> (color var) => green Now this is a different way of giving properties. After these, object-properties gives an empty alist. So given the documentation, I thought I should use "the new way". If I cannot find out how, then maybe I should use "the old way" :-) Thank you again for answering. I will be very happy if you can answer the environment questions. PS: I thought I should CC this to the guile-user list just in case someone else may need the answer to these questions more than some spam :-) _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user