Path: utzoo!utgpu!attcan!uunet!husc6!mailrus!ames!pasteur!agate!e260-3b.berkeley.edu!128a-3aj From: 128a-3aj@e260-3b.berkeley.edu (Jonathan Dubman) Newsgroups: comp.lang.scheme Subject: Limitation with lambda Keywords: lambda Message-ID: <15590@agate.BERKELEY.EDU> Date: 17 Oct 88 17:00:42 GMT Sender: usenet@agate.BERKELEY.EDU Reply-To: 128a-3aj@e260-3b.berkeley.edu (Jonathan Dubman) Organization: University of California, Berkeley Lines: 28 There seems to be a gross omission in the lambda primitive. It seems like there is no way to create a recursive function on the fly! I'm reading the Abelson and Sussman book but they seem to avoid this issue. For example, how would someone write a function generator that generates the sum of all squares or cubes or fourths, etc., based on an exponent? Bear with me, as I'm not a Scheme expert. My specific problem arises from trying to write a simple object-oriented mini-adventure in Scheme. There are two types of objects: players and rooms. Rooms have four exits. Given a direction and a player, the room will move the player to the new room in that direction. Players have a current room. They accept two messages: 'move direction and 'hop new-room. Say you tell a player to go north. He knows his current room and asks that room to send him north. But how can that happen, if the player doesn't know his own name? Make-player, which is a call to a lambda, can't tell the current room to move the player in the given direction because the player isn't defined until after the lambda is finished! One possible solution is to change the communication method so that players merely ask the room where the exit goes and move THEMSELVES. But that's not the way I wanted to do it. Help! What can I do? -Jonathan Dubman