lua-users home
lua-l archive

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


2009/11/5 Joseph Stewart <joseph.stewart@gmail.com>:
> ...then you could make the constructor like this:
>
> local m = dim(100,100)
>
> ;-)

This syntax is already supported by gsl shell, I can write

local m = new(100, 100)

but also

local m = new(100, 100, |i, j| i+2*j)

this latter form takes a third argument that should be a function to
initialise the matrix. I've added in GSL shell the notation

|x, y| x+2*y

to mean

function(x, y) return x+2*y end

The idea was borrowed from Metalua and I think that's really handy.

;-)

Francesco