[racket] Basic inquiry

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat May 12 09:40:30 EDT 2012

On May 12, 2012, at 8:35 AM, saad bashir wrote:

> Dear Matthias,
> 
> Thank you for replying to me.  I am sure this is laughably basic for you.

It is basic for me, but there's nothing laughable. 


> I got what you wrote.  I know string-ith extracts the letter.  My question is how to use it. I have tried various ways of writing both in the def and interaction sections but have not worked out.  Even consulting the Helpdesk has not helped as it does not tell me how to use the fucntion.
> 
> Sorry if I am being very thick. I really want to do it right.
> 


If you have a DrRacket in front of you, does it say 

  "Welcome to DrRacket, version 5.2.1"
  Language: Beginning Student.

in the Interactions WIndow? If not, you need to switch languages with the Language menu. 

Once you have switched languages, click run. Then try these interactions: 

> (string-ith "hello world" 0)
"h"
> (string-ith "hello world" 1)
"e"
> (string-ith "hello world" 2)
"l"
> (string-ith "hello world" 3)
"l"
> 

Please let me know which step went wrong previously. -- Matthias





> Saad
> 
> On Fri, May 11, 2012 at 11:47 PM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
> 
> The beginning of section 2.1.3 looks like this:
> 
> 
> > All other operations concerning strings consume or produce data other than strings. Here are some examples:
> >       • string-length consumes a string and produces a (natural) number;
> >
> >       • string-ith consumes a string s and extracts the one-character substring located at the ith position (counting from 0); and
> >
> >       • number->string consumes a number and produces a string.
> >
> > Also look up substring and find out what it does.
> 
> Which function do you think extracts a "letter" from a string? [[You can follow the links for the function names. Perhaps it is easier to read the docs.]]
> 
> -- Matthias
> 
> 
> 
> 
> On May 11, 2012, at 4:22 PM, saad bashir wrote:
> 
> > I am back again.  I had a basic inquiry and your help got me started.
> >
> > My problem is as follows:
> >
> > I have just started to work through 2Htdp (i.e. the second edition) that you had guided me to. Having gone through the prologue I am now on the second chapter, "Fixed-size data."  But have got stuck almost at the start.  I have successfully done the first two exercises but have hit a road block on exercise 3 (section 2.1.3 "Mixing it up").  I do not know what instruction to use to insert or extract a letter from the ith position.  I think I am doing something wrong when trying to look up things in Helpdesk. Please help.
> >
> > Saad
> >
> > On Fri, Apr 27, 2012 at 8:32 PM, Danny Yoo <dyoo at cs.wpi.edu> wrote:
> > On Fri, Apr 27, 2012 at 11:27 AM, saad bashir <bashir.saad at gmail.com> wrote:
> > > Your help was great.  Things are working now.  And a great thank you for
> > > leading me to the 2d edition of How to Design Programs.  I had not known
> > > about it.
> >
> >
> > Glad to hear that it's working for you now!  Please feel free to
> > continue to ask questions on the mailing list; we'll be happy to help.
> >
> > ____________________
> >  Racket Users list:
> >  http://lists.racket-lang.org/users
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120512/0795263f/attachment-0001.html>

Posted on the users mailing list.