question about symbol->string, string->list 
Author Message
 question about symbol->string, string->list

Can anyone help me write a function that reads in a symbol and converts it
to a list.
I am a little confused on where it goes once it is a list?

Thanks

Cat



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list

Quote:

>Can anyone help me write a function that reads in a symbol and converts it
>to a list.
>I am a little confused on where it goes once it is a list?

What does it mean to convert a symbol to a list?  A list of what?

--

Genuity, 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.



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list
oh sorry, I am trying to write an infix parser that takes in a list of
inputs.  So, it can include numbers and operators and in the end variables.
But if you enter 3+2 scheme recognizes it as a symbol so, I was thinking of
coverting a symbol into a list and then reparsing it so that it is seen as
an expression to be evaluated.


Quote:


> >Can anyone help me write a function that reads in a symbol and converts
it
> >to a list.
> >I am a little confused on where it goes once it is a list?

> What does it mean to convert a symbol to a list?  A list of what?

> --

> Genuity, 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.



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list

Quote:

> oh sorry, I am trying to write an infix parser that takes in a list of
> inputs.  

I don't know if you are doing this just for your own learning, but if
you aren't, there was actually an infix parser for (Guile) Scheme
posted to the Guile mailing list recently...here's the link.

http://www.cl.cam.ac.uk/users/ig206/guile-arith/guile-arith-0.01.tar.gz



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list
+---------------
| oh sorry, I am trying to write an infix parser that takes in a list of
| inputs.  So, it can include numbers and operators and in the end variables.
| But if you enter 3+2 scheme recognizes it as a symbol so...
+---------------

Why not just read the input character-at-a-time with "read-char"?
Or if your Scheme has "read-line" (and your inputs are guaranteed
to be less than one line):

    > (begin (read-char) ; throw away the NL at the end of this sexpr
             (string->list (read-line)))
    Hello 5*(3+4)-2
    (#\H #\e #\l #\l #\o #\space #\5 #\* #\( #\3 #\+ #\4 #\) #\- #\2 #\space)
    >

-Rob

-----

Applied Networking              http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.          Phone: 650-933-1673
1600 Amphitheatre Pkwy.         PP-ASEL-IA
Mountain View, CA  94043



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list

Quote:
> oh sorry, I am trying to write an infix parser that takes in a list of
> inputs.  So, it can include numbers and operators and in the end variables.
> But if you enter 3+2 scheme recognizes it as a symbol so, I was thinking of

One thing you might try is writing your expressions in the form (3 + 2)
so scheme recognizes it as a list of symbols.  That way, you can
concentrate on the infix parsing rather than worrying about the string/symbol
parsing.

Alex



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list
but if I then have a string of chars, will this still allow 5*(3+4)-2 to be
evaluated?
I'm confused.  =)

Cat


Quote:

> +---------------
> | oh sorry, I am trying to write an infix parser that takes in a list of
> | inputs.  So, it can include numbers and operators and in the end
variables.
> | But if you enter 3+2 scheme recognizes it as a symbol so...
> +---------------

> Why not just read the input character-at-a-time with "read-char"?
> Or if your Scheme has "read-line" (and your inputs are guaranteed
> to be less than one line):

>     > (begin (read-char) ; throw away the NL at the end of this sexpr
>      (string->list (read-line)))
>     Hello 5*(3+4)-2
>     (#\H #\e #\l #\l #\o #\space #\5 #\* #\( #\3 #\+ #\4 #\) #\- #\2
#\space)

> -Rob

> -----

> Applied Networking http://reality.sgi.com/rpw3/
> Silicon Graphics, Inc. Phone: 650-933-1673
> 1600 Amphitheatre Pkwy. PP-ASEL-IA
> Mountain View, CA  94043



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list

Quote:

>but if I then have a string of chars, will this still allow 5*(3+4)-2 to be
>evaluated?
>I'm confused.  =)

Once you have a string or list of characters, you then have to parse it to
figure out where each number, operator, etc. is.

This is the part of the homework that's supposed to be challenging to you.
Don't expect us to write it for you.

--

Genuity, 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.



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list
Well, if I was in school than I would of learned this and wouldn't have to
ask for help from a newsgroup, now would I?

And this was such a simple question that required a really simple answer.

Psychology is wonderful degree where you go into because you want to help
people, why do people go into computers if they are not willing to share
their knowledge?

-Cat


Quote:


> >but if I then have a string of chars, will this still allow 5*(3+4)-2 to
be
> >evaluated?
> >I'm confused.  =)

> Once you have a string or list of characters, you then have to parse it to
> figure out where each number, operator, etc. is.

> This is the part of the homework that's supposed to be challenging to you.
> Don't expect us to write it for you.

> --

> Genuity, 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.


Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list
this is why i'm going back to school ^_^

slightly off-topic:
anyone that would be interested, check out http://ftp.rook.com.au - the Vapour
project (a lisp-ish OS ... yes, another :P)

Quote:

> Well, if I was in school than I would of learned this and wouldn't have to
> ask for help from a newsgroup, now would I?

> And this was such a simple question that required a really simple answer.

> Psychology is wonderful degree where you go into because you want to help
> people, why do people go into computers if they are not willing to share
> their knowledge?

> -Cat





> > >but if I then have a string of chars, will this still allow 5*(3+4)-2 to
> be
> > >evaluated?
> > >I'm confused.  =)

> > Once you have a string or list of characters, you then have to parse it to
> > figure out where each number, operator, etc. is.

> > This is the part of the homework that's supposed to be challenging to you.
> > Don't expect us to write it for you.

> > --

> > Genuity, 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.



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list

Quote:

> but if I then have a string of chars, will this still allow 5*(3+4)-2 to be
> evaluated?
> I'm confused.  =)

> Cat

You can evaluate the string "5-(3+4)*22" in two steps:

 (1) Turn it into to a list of tokens like
       (5 - lparen 3 + 4 rparen * 22 end)
     (The addition of an end token makes step 2 a bit easier.)

 (2) Then performing the evaluation on that list of tokens, respecting
     normal rules of precedence and associativity by doing the
     multiplication before the subtraction, e.g.

This two step process is spelled out in chapter 13 of the textbook I
co-authored, Concrete Abstractions: An Introduction to Computer
Science Using Scheme. http://www.gustavus.edu/~max/concrete-abstractions.html

 -Max Hailperin
  Associate Professor of Computer Science
  Gustavus Adolphus College
  800 W. College Ave.
  St. Peter, MN 56082
  USA
  http://www.gustavus.edu/~max/\



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list

Quote:

>Well, if I was in school than I would of learned this and wouldn't have to
>ask for help from a newsgroup, now would I?

Well, I don't know you well enough to know whether *you* would, but
certainly lots of other students do.  Your message was very much like the
ones that they post.

--

Genuity, 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.



Tue, 31 Dec 2002 03:00:00 GMT  
 question about symbol->string, string->list
I am just trying to do something that I thought was simple.  I wrote a small
calculator type program in C++, and prolog, and now I am trying to write one
in scheme.  I figured it would be the best way to learn to code.  Some of it
just makes no sense what so ever.

Thanks for the help!



Wed, 01 Jan 2003 03:00:00 GMT  
 question about symbol->string, string->list

Quote:
> this is why i'm going back to school ^_^

> slightly off-topic:
> anyone that would be interested, check out http://ftp.rook.com.au - the
Vapour
> project (a lisp-ish OS ... yes, another :P)

This strikes my curiousity. What other ones are there? Any links to this
sort of stuff?

Best Regards,
Kevin Holmes
"extrasolar"



Wed, 01 Jan 2003 03:00:00 GMT  
 
 [ 23 post ]  Go to page: [1] [2]

 Relevant Pages 

1. string->list->string

2. MIT scheme: string->list on long strings

3. string->symbol question.

4. list->string question

5. string->symbol ?!

6. dealing with string->symbol under PLT

7. bug or feature string->symbol?

8. string->symbol and case insensitivity confusion

9. String => Symbol

10. howto string->symbol

11. Casting operators (string -> symbol, keyword) in Lisp

12. Output to strings / F>STRING

 

 
Powered by phpBB® Forum Software