[plt-scheme] Re: Casting SPELs in Lisp^H^H^H^H Scheme

From: jacmoe (jacmoe at mail.dk)
Date: Thu Feb 18 13:14:27 EST 2010

That was the issue. Thanks a lot! :)
So, the code becomes:
(define *chain-welded* #f)

(define *bucket-filled* #f)

(define (set-chain-welded)
  (set! *chain-welded* #t))

(define (set-bucket-filled)
  (set! *bucket-filled* #t))

And later:
(game-action weld chain bucket attic
  (cond [(have 'bucket)
         (set-chain-welded)
         '(the chain is now securely welded to the bucket.)]
        [else '(you do not have a bucket.)]))

Likewise for the bucket.

Jacob

On Feb 18, 6:55 pm, Carl Eastlund <c... at ccs.neu.edu> wrote:
> I'm not 100% sure this is what you're running into, but it sounds like it:
>
> If a variable inside a module is not modified by any code in the
> module, it gets compiled as an immutable constant.  If you want to be
> able to modify it, define (and, perhaps, export) a setter inside the
> module.  Then it will be compiled as mutable.
>
> Carl Eastlund
>
> On Thu, Feb 18, 2010 at 12:46 PM, jacmoe <jac... at mail.dk> wrote:
> > Excellent! :D
> > I do get an error, when trying to run this in DrScheme:
> > (set! *chain-welded* #t) -> set!: cannot modify a constant: *chain-
> > welded*
>
> > I am using Language : module, so it should use full scheme.
>
> > Any hints for a new Schemer? :)
>
> _________________________________________________
>   For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.