[plt-scheme] Defining structures

From: Marco Morazan (morazanm at gmail.com)
Date: Thu Feb 19 07:03:46 EST 2009

On Wed, Feb 18, 2009 at 4:26 PM, Todd O'Bryan <toddobryan at gmail.com> wrote:
> On Wed, Feb 18, 2009 at 1:52 PM, aditya shukla
> <adityashukla1983 at gmail.com> wrote:
>> A question that comes to mind if variables in scheme do not have type in
>> scheme thus can be say that
>> (define a 9) -here a is a placeholder for a value whose tag is a number
>>> (define a 'aditya)
>> define: cannot redefine name: a
>> why can't we redefine a here?
>> Aditya
> Because you can only define something once. It doesn't have to do with
> the type--even if you tried to redefine a as another number, you'd
> still get the same error:
> (define a 1)
> (define a 2) <---- Scheme doesn't like this either

It really has to do with the restrictions imposed by the (student)
language you are using. One of the restrictions is that you can only
define a variable once. Full Scheme will allow you to redefine
anything (i.e. a variable, a function, etc.).

The question, Aditya, is why would you want to redefine a variable?
What sense does it make to define a variable more than once?




Posted on the users mailing list.