On Fri, 27 Jan 2017, Allin Cottrell wrote:
On Fri, 27 Jan 2017, Sven Schreiber wrote:
>
> <hansl>
> matrix m = 1
> transp(m) = {0, 1; 2, 3}
> print m # gives 1 (1x1)
> </hansl>
The trouble here is that transp(m) is -- in C lingo -- "not an
lvalue". You cannot assign anything to the anonymous return value
from a function call.
One more comment on this. If you write something along the lines of
any of the following
transp(m) = <some matrix>
m' = <some matrix>
-x = 3
sqrt(x) = 2
you're treating the statement as an equation that you expect the
interpreter to solve. There may be some symbolic algebra languages
that work like that, but hansl is a plain old declarative language and
"no can do". You can't do this in any C-like language, nor in any
scripting language that I'm familiar with.
A valid "lvalue" must be the identifier of an existing object
(possibly followed by a member-of specification), or (in a language
like hansl which does not insist on pre-declaration) a name which is
valid as identifier for a newly-created object.
Allin