Post Reply 
Why do characters get interpreted as algebraics?
05-21-2014, 07:44 PM
Post: #11
RE: Why do characters get interpreted as algebraics?
(05-21-2014 06:09 PM)HP67 Wrote:  ...OTOH ->STR seems to produce strange results. A global name gets turned into a string but with single quotes inside the double quotes. It would be great if somebody can explain this.

Perhaps Tim already did, but if so then I didn't understand what he wrote.

Short answer: because that's how it was designed to work. Smile

Longer answer:

It's important to remember that, in RPL terms, there is a big difference between:
"String" and 'String'

The first is an object containing a string of characters, the second is an identifier for an object (not the object itself). They are entirely different object types, in the same sense that a real number:
1.234

is an entirely different kind of object from a string:
"abc"

Generally speaking, ->STR gives you a string whose contents represent the way something would look on the stack (without the quote marks, of course). Furthermore, there's a reciprocal function to ->STR: OBJ->. OBJ-> works by attempting to evaluate the contents of the string. This is why the single quotes are important; they are needed to make sure that you get the object identifier back, not its contents.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Why do characters get interpreted as algebraics? - DavidM - 05-21-2014 07:44 PM



User(s) browsing this thread: 1 Guest(s)