; An example of an object definition (define GenericMagicLamp ; this is what we want to return (lambda (noOfWishes) (define count 0) ;a local variable (lambda () (if (< count noOfWishes) (begin (set! count (+ 1 count)) 'Granted) '(you've had all you're going to get!)) ))) ;use the object ; (define AlladinsLamp (GenericMagicLamp 1)) ;when we use ;(AlladinsLamp) ;granted ;(AlladinsLamp) ;you've had all your're going to get!