home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.scheme
- Path: sparky!uunet!math.fu-berlin.de!Sirius.dfn.de!news.DKRZ-Hamburg.DE!rzsun2.informatik.uni-hamburg.de!rzdspc5!a2husek
- From: a2husek@rzdspc5.informatik.uni-hamburg.de (Carsten Husek)
- Subject: Problems with Objekts-implementation in pure Scheme
- Message-ID: <a2husek.728138721@rzdspc5>
- Summary: Programming problems with Objekts and their implementation
- Keywords: Objekts, scheme
- Sender: news@informatik.uni-hamburg.de (Mr. News)
- Organization: University of Hamburg, FRG
- Date: 27 Jan 93 12:45:21 GMT
- Lines: 31
-
- Hello !
-
- I'm experimenting with Objekts in Scheme usung SICP of Abelson&Sussman
- Consider this problem:
-
- I)(define (construct-objekt a b c)
- (lambda (command instance)
- (if (eq? command 'get-value-of) (eval instance))))
-
- II)(define myobj (construct-objekt 1 2 3))
-
- III)(myobj 'get-value-of 'a)
-
- This should return the value 1. But both the interpeter on my PC and the
- interpeter at my University (Hamburg) return the error:" Top-Level Symbol A
- unbound" !!!!!
- Why ?
- Here is my interpretation of the programm and why it should work well.
- If you use the environment-modell presented in Chapter 3.2.3 in SICP picture
- 3.7 (German translation of the book, but Chapter & Picture of should be the
- same) II) should evaluate to an environment E1 where a,b,c are bound to their
- respective values. The myobj-LAMBDA construct should execute in E1.
- In E1 ,given command III), (eval inst) should be exactly the same as (eval a),
- and executing (eval a) in E1 should return 1 !!!
- Can somebody help me? And please explain my misconceptions about environments
- and bindings?
-
- -Carsten
-
- "Who thinks that he thinks, thinks only that he thinks"
- -rare proverb
-