From: Patrick Summers
Subject: reading string literals
Date: 
Message-ID: <7ug0jd$qut$1@bgtnsc03.worldnet.att.net>
Hello all,

I am new to LISP, but have still managed to write MOST of my phone list
homework assignment in it.  However, I am having one small problem:

I would like to have the user input a persons name, but have it treated as a
string literal.  When I use the code
(setq firstname (read)) and the user types: Bill
it returns BILL.

How can I read it in as "Bill" without the user typing the quotes?

I would like a simple Stringread function, which the version of Harlequin
LispWorks I'm using does have (I've seen in the list of errors when I make a
mistake), but I can't find any documentation on how to use it.

Thanks in advance,
Pat Summers

From: Barry Margolin
Subject: Re: reading string literals
Date: 
Message-ID: <6QLO3.45$UJ6.1609@burlma1-snr2>
In article <············@bgtnsc03.worldnet.att.net>,
Patrick Summers <·········@worldnet.att.net> wrote:
>Hello all,
>
>I am new to LISP, but have still managed to write MOST of my phone list
>homework assignment in it.  However, I am having one small problem:
>
>I would like to have the user input a persons name, but have it treated as a
>string literal.  When I use the code
>(setq firstname (read)) and the user types: Bill
>it returns BILL.
>
>How can I read it in as "Bill" without the user typing the quotes?

Try READ-LINE.  This will read a line of input as a string.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Erik Naggum
Subject: Re: reading string literals
Date: 
Message-ID: <3149270544379358@naggum.no>
* "Patrick Summers" <·········@worldnet.att.net>
| I would like to have the user input a persons name, but have it treated
| as a string literal.  When I use the code (setq firstname (read)) and the
| user types: Bill it returns BILL.

  READ parses and returns Lisp expressions and data.

| How can I read it in as "Bill" without the user typing the quotes?

  well, the user obviously needs to terminate his input with something, and
  that something is typically a line terminator, too, which means that
  READ-LINE should seem like a fairly typical thing to think of.

| I would like a simple Stringread function, which the version of Harlequin
| LispWorks I'm using does have (I've seen in the list of errors when I make a
| mistake), but I can't find any documentation on how to use it.

  the problem with introspective environments is that people who have no
  idea what to look for tend to find the strangest things.  try a textbook
  and make sure you leave your old language backgrounds behind: try to
  grasp what the language is giving you, rather than insist on taking what
  you think it ought to have.

#:Erik
From: Erann Gat
Subject: Re: reading string literals
Date: 
Message-ID: <gat-1810991626540001@milo.jpl.nasa.gov>
In article <············@bgtnsc03.worldnet.att.net>, "Patrick Summers"
<·········@worldnet.att.net> wrote:

> Hello all,
> 
> I am new to LISP, but have still managed to write MOST of my phone list
> homework assignment in it.  However, I am having one small problem:
> 
> I would like to have the user input a persons name, but have it treated as a
> string literal.  When I use the code
> (setq firstname (read)) and the user types: Bill
> it returns BILL.
> 
> How can I read it in as "Bill" without the user typing the quotes?

Use READ-LINE.  (Or you can write your own reader function using
READ-CHAR.)

Erann Gat
···@jpl.nasa.gov