lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi all,

On my continual quest for the perfect math language, I found GSL shell, which
seems awesome except that it lacks the one thing Matlab does really well:  super
sweet matrix syntax, mostly for defining matrices with a minimum of keystrokes
and looking a lot like subscripted mathematics.  

Like this:

A = [1 2 3]'
B = [1 1 1; 0 1 1; 0 0 1]
C = B * A
C(2,3) = 4   (ok to use "[" in an extension, but C[2][3] is ugly)
D = B .* A   (using octave's new broadcasting syntax)
E = B[1:2,end-1] (pull out the 2nd to last column, 1st 2 rows)

Some may find this downright cloying and saccharin, but I love it and it would
make many Matlab trained engineers happy (and there are A LOT of Matlab trained
engineers in the world...). 

Does GSL-Shell already have this extension? 

Is it possible to overload Lua to do this?

Francesco -- would you be interested in modifying GSL-Shell if this worked (I
know you are here ;) ) 

Could someone smarter than me sketch how to do it with metalua? 

I don't think a lot of sugar is necessary to make it Matlab friendly (and even
better than Matlab!)  I wouldn't change anything except the matrix indexing
syntax -- cell arrays etc are pretty silly....

Thanks!