|
FOR
and IF
STO store an object into a variable. the variable name is a string. |
exemple.
123
"aaa"
|
please note : that a file script_aaa is created and contains now 123 |
Go into your VAR menu and hit aaa the content of aaa is restored onto the stack |
||
You can also use Exec which do the same |
"aaa"
gives 123 |
Please note that Exec is not the same as RCL , see further for details |
STO
, Exec
and other functions...
Serialize |
transform an objet (any type) into a string. internaly used to write data into a file. |
example : [ 1 2 ] is serialized as "\7 2 \1 1 \1 2 "hi!" is serialized as \4 3 3 $hi! { 1 2 "hi" } is serializedas \6 3 \1 1 \1 2 \4 2 2 $hi
|
unSerialize |
perform the reversal, read a string and create the corresponding objet. internaly used to read variable from VAR |
"\6 2 555 444 gives { 555 444 } 6 is the type for list. 2 is the number of item. there are cariage returns between each items |
instead of... | ...you can write |
\1 123 | 123 |
\4 2 2 $hi | "hi" |
type
and how many object it contains).\6 3 \1 1 \1 2 \4 2 2 $hi
, you can just write \6 3 1 2 "hi"
which means (object type 6 : list of 3 items : 1, 2 and "hi")STO
)unSerialize
. in case you did not store it into a variable.{ 1 + }
and to use list->script
to create the serialised script "1 /! +". (note in hp this corresponds to << 1 + >>)
in hp style | in QLE | QLE converted with List->script |
<< 0 SWAP 1 SWAP FOR i i SQR + NEXT >> |
{ 0 swap 1 SWAP for index sqr + next }you can see how similar to hp is it... |
0 \! SWAP 1 \! SWAP \@ FOR \@ INDEX \! Sqr \! + \@ NEXT |
List->script
unSerialize
(Exec
works only in stored variable). Please don't forget to place a number in the stack before...STO
, as script are string (you can use STO
for program because program are not string).STOScript
function, this function does not perform any serialization, in this way it will be executed.I want to... | on a hp | on RPNE |
I want to run a stored program. (the name is "hi") | go to VAR, hit hi |
go to VAR, hit hi |
I want to run a stored program. (the name is "hi") without going into VAR | 'hi' EVAL |
"hi" Exec |
I want to get the content of the program into the stack | 'hi' RCL |
"hi" RCL |
I want to execute a program from the stack | EVAL |
unSerialize (for script)run (for program) |
STO |
Serialize an object and store it into a variable (file) |
Exec |
Restore and unSerialize the VAR. (this is used to read a file and to execute a script) |
RCL |
Restore without unSerialize, finaly it's just like a FileRead , only usefull on scripts |
List->script |
convert a list into a script (a string) |
Serialize |
this operation convert any objet into a string. this is a low level operation. |
unSerialize |
this operation convert back string into object. this also compute scripts. |