Home  |   Notes  |   Languages  |   Programs  |   Homework

Re: assignment (p2)

New Message Reply About this list Date view Thread view Subject view Author view

Andrew A. Ray (anray2@VT.EDU)
Sun, 21 Oct 2001 13:01:28 -0400


Message-ID:  <1003683688.6975.33.camel@anray2.campus.vt.edu>
Date:         Sun, 21 Oct 2001 13:01:28 -0400
From: "Andrew A. Ray" <anray2@VT.EDU>
Subject:      Re: assignment (p2)

Well, think about what you have to do and what features Scheme allows us
to use (within the program specifictions).

istore 2
This takes the value off of the the top of the stack and puts it in the
3rd place in the list of values passed in to the program.

In C++ you would simply do array[2] = stack.pop();
In Scheme you have to use recursion so you would have a function that
calls itself and would more than likely return a list.

When you get to the specific element you want to replace, what should
you do? Think about what parmaters you would need in such a function
and what return type you would need.

On Sun, 2001-10-21 at 12:24, dsmk wrote:
> Indeed I use recursion to arrive at the desired 'letter', my problem is...
> 1) The only way I know to reassign, w/o reassigning is to get rid of the
> current value, and cons the new value in its place.
> 2) I dont want to lose all the 'letters' in front of the one I'm reassigning.
> I have devised a way to do this, but it didn't work like I had planed.
> I'm just wondering if I am missing something.
> suggestions?
> -Chris
>
>
> At 06:44 AM 10/21/2001 -0400, you wrote:
> >Recursion is your friend, think about it for a bit and if you still
> >don't understand email the professor or the list-serv.
> >
> >On Sat, 2001-10-20 at 23:50, dsmk wrote:
> > > If we aren't allowed to have assignments, how are we supposed to "istore"
> > > values?
> > > -Chris


New Message Reply About this list Date view Thread view Subject view Author view

Home  |   Notes  |   Languages  |   Programs  |   Homework
copyright © 2001 Virginia Tech, ALL RIGHTS RESERVED
Class site maintained by Stephen H. Edwards <edwards@cs.vt.edu>