[plt-scheme] Lexical Scoping, References and Side Effects

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Sep 2 03:30:14 EDT 2009

On Aug 30, 2009, at 7:42 PM, tbourdon wrote:

> Hello -
> I'm currently teaching myself  Scheme by working through "Teach
> Yourself Scheme in Fixnum Days" and "The Little Schemer". As I was
> working through the sources I decided to break off and implement some
> stack data structures. So far I've implemented the stack functions
> three different ways and I've noticed that I really can't (or haven't
> found a way) to create a reference to a stack and pass it around to be
> operated on.
> For example; I can't come up with an implementation for a stack-push
> function where the following works:
> (define stack ())
> (stack-push stack 1)
> (stack-top stack) => 1

You omitted the most important part of your quasi-spec? What should  
stack-push return?

Posted on the users mailing list.