home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / scheme / 2981 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.6 KB  |  44 lines

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