There is some syntax for the software which is convenient when
performing operations on variables that we need for just a temporary
operation. For example, to calculate 2^3, we may proceed as
we have been doing:
Note the last four examples involve the same expression, except we use
different syntax that makes the operation more readable and more
natural and, in the last case, we assign the value of the whole
expression to a new variable d. So this is something we can do in case we need to use d in the future. You can check that the other variables are gone and only d remains in the atlas memory
We just need to make sure that the strings of let=something
are terminated with in. There are times when the
nested expressions you want can get complicated and it is hard to keep
track. So the software keeps track and reminds you that more
information is needed to finish the expression:
atlas>leta=2L>inletb=3L>ina*bValue:6atlas>
Another thing to notice, for example, if we use y in
the expression above, this will not interfere with the process even
though y was assigned a different value before:
So, a did go away since it was a local variable. However, the
local value of y inside the let syntax dissapeared after the
operation was performed and did not interfere with anything outside. Moreover, its first assigned (non-local) value was retained.
The ; syntax
Another useful syntax symbol is ;. It is used between
expressions to ask atlas to just perform the last operation:
atlas>letx=2inlety=3inx^y;x+yValue:5atlas>
A more useful application of this is, for example, with the prints
statements. We may ask atlas to print some output. But if we want
atlas to perform an operation with te output and print both the
intitial output and the result, we may run into the following types of
problems:
There are two problems happenning here. When we ask on the first line
to print the values of the local variables atlas lists them as
part of the string. However, atlas did not keep in memory the
values of the local variables x and y. So when we assign a
value to the new variable t, it looked elsewhere for the values of
x and y. Since we had set y=2^3, this was not done as a local variable and atlas gives that value for y.
The second problem is that regardles of whether the variables were
local or not, the prints command returns type void and
typing t again does not give us back what we had asked atlas
to print.
This second problem does not get fixed by redefining x and y:
The last for loop uses # which means append the ith expression
to the previous one. Now if we only care about the last value of
v, we can use ; as follows: