5 Dec 2007 12:23
Using |s| as a variable name
nicola <vitacolo <at> dimi.uniud.it>
2007-12-05 11:23:03 GMT
2007-12-05 11:23:03 GMT
Hello,
I am a bit puzzled by the way a name like |s| may behave. Why is this
seemingly correct:
string s;
s = "aaaaaaa";
|s| = length s;
show |s|;
and why does the following produce an error?
string s;
s = "aaaaaaa";
|s| = length s;
for i = 1 upto |s|:
;
endfor;
>> |s|:
! Improper final value has been replaced by 0.
I would like to use |s| in a subroutine, as follows:
vardef foo(expr x) =
|x| := length x;
enddef;
string s;
s = "abc";
foo(s);
(Continue reading)
RSS Feed