[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
proper lvalues and whatnot
From: |
Ross A. Lippert |
Subject: |
proper lvalues and whatnot |
Date: |
Fri, 18 Aug 2000 10:29:34 -0600 |
One of the neat things about octave is its incorporation of
C-like syntax, with cool operators like ++ and += and so on.
I am wondering why it is not the case that assignment expressions
are not likewise lvalues?
Is there some reason why
octave> (v = zeros(1,2))++
should not give
v = [1 1]
??
Also, I am wondering why it is that while subscripted vectors/matrices
are lvalues, that
octave> v = [1 1];
octave> v([1 1 2])++
does not give
v = [3 2];
??
OK, so maybe I am a sick puppy. But this is what I am really after.
> [i,j,nz] = find(M);
> (y=zeros(max(i),1))(i) += nz.*x(j)
and have
y = M*x
I have a lot of sparse matrices I want to play with and this sort of
syntax would rock.
Is there a conceptual reason why I should not try to modify octave to
do this (i.e. how does this break the .m language as a language)?
Is there a technical reason why I should not try to modify octave to
do this (i.e. requires a total interpreter rewrite, I'd be in over my
head)?
-r
- proper lvalues and whatnot,
Ross A. Lippert <=